How to set layout_span through code

后端 未结 1 1125
野的像风
野的像风 2021-01-03 20:03

Does anyone know how to set/change the android:layout_span=\"\" of an EditText in Android at runtime. I already have the EditText defined in my XML file.

相关标签:
1条回答
  • 2021-01-03 20:27

    You can use:

    TableRow.LayoutParams params = (TableRow.LayoutParams)editText.getLayoutParams();
    params.span = toSpan;
    editText.setLayoutParams(params); // causes layout update
    
    0 讨论(0)
提交回复
热议问题