当视图显示不完整时,将其设置为已消失

时间:2017-05-27 07:15:44

标签: android android-layout

有一个水平的LinearLayout,在LinearLayout中有一些TextView int。一些TextView是Gone或Visibile取决于数据
TextView中的文本不是固定的。当文字太长时。它将显示部分。
一些TextView是Gone或Visibile取决于数据
例如

the 1st TextView is  "qwerty", it width is 100dp  
the 2st TextView is  "qwerty", it width is 100dp 
the 3st TextView is  "qwerty", it width is 100dp 
the 4st TextView is  "qwerty", it width is 100dp 
the LinearLayout's width is 280dp 

所以隐藏第3个TextView和第4个TextView。

RecyclerView中的LinearLayout,因此无法删除子项,因为子项将在其他项目中重用。并且在快速滚动时不需要太多时间来测量垃圾的宽度。

1 个答案:

答案 0 :(得分:0)

你可以让它滚动 或者给予线性布局的权重和= 2,对于2个文本给出权重= 1和宽度= 0dp和高度wrap_content