如何动态更改Android View的布局

时间:2018-09-07 16:19:58

标签: android linearlayoutmanager

enter image description here我要设计自定义的LinearLayout。

 <LinearLayout
        android:layout_height = "wrap_content"
        android:layout_width = "match_parent"
        orientation="horizontal">
        <ImageView/>
        <TextView/

>         

我正在自定义类中加载此布局。 我的问题取决于TextView的用户输入字符串长度,我想在Textview下方显示Button。如果String的长度足够小,以至于包括所有填充在内的所有三个控件都可以放在一行中,则在一行中显示,否则将按钮放在TextView + Image下方。

0 个答案:

没有答案