IT/ANDROID
[ANDROID/KOTLIN] layout_weight 코드로 수정하기
_JinHa_
2021. 1. 12. 09:51
반응형
fun setWeight(data: ItemListTop_Data){
// LinearLayout layout_weight 코드 설정 방법
// val layoutParams = 변수명.layoutParams as LayoutParams
// layoutParams.weight = 2f
val layoutParams = linearL_item_list_top.layoutParams as LayoutParams
layoutParams.weight = data.layout_weight
}
[참고]
출처 :
stackoverflow.com/questions/3224193/set-the-layout-weight-of-a-textview-programmatically
Set the layout weight of a TextView programmatically
I'm trying to dynamically create TableRow objects and add them to a TableLayout. The TableRow objects has 2 items, a TextView and a CheckBox. The TextView items need to have their layout weight set...
stackoverflow.com
stackoverflow.com/questions/13016216/how-to-programmatically-set-weight-for-button
How to programmatically set weight for Button
I need to implement Dialog for my Android app through Java code, so I can't use XML. I have root LinearLayout where I implement range seek bar, then I have another LinearLayout under root layout, ...
stackoverflow.com
반응형