style(gjc): 开始组装页运单列表 5 列间距均分,表头两种状态各用一套列宽
- 新增 AssembleWaybillColumns:「件数/重量」与「剩余件数/总件数」两种表头状态 各一套列宽,表头按 hasLoadedOnce、列表项按 showRemaining 切换,保证列对齐 - 件数与重量之间加弹性间隔;剩余态重量列放宽到 140dp,大重量不换行 - module_base 新增通用 layoutWeight 绑定适配器 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package com.lukouguoji.module_base.adapter
|
||||
|
||||
import android.view.View
|
||||
import android.widget.EditText
|
||||
import android.widget.LinearLayout
|
||||
import androidx.databinding.BindingAdapter
|
||||
import com.lukouguoji.module_base.interfaces.IOnFocusChangeListener
|
||||
|
||||
@@ -27,6 +28,18 @@ fun visible(view: View, visible: Any?) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态设置 LinearLayout 子 View 的 layout_weight(如按状态切换列宽)
|
||||
*/
|
||||
@BindingAdapter("layoutWeight")
|
||||
fun setLayoutWeight(view: View, weight: Float) {
|
||||
val lp = view.layoutParams as? LinearLayout.LayoutParams ?: return
|
||||
if (lp.weight != weight) {
|
||||
lp.weight = weight
|
||||
view.layoutParams = lp
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("setFocusChangedListener")
|
||||
fun setOnFocusChangeListener(et: EditText, listener: IOnFocusChangeListener) {
|
||||
et.onFocusChangeListener = View.OnFocusChangeListener { v, hasFocus ->
|
||||
|
||||
Reference in New Issue
Block a user