我必须设计UI以包含两列.
第一列应该包含包含的标签,第二列应该在同一行中填充整个空格.下面是一些例子:
我怎样才能做到这一点 ?
解决方法:
使用TableLayout和strechColumns =“1”
它延伸第二列占据剩余空间.
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="1" >
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
标签:android,android-layout
来源: https://codeday.me/bug/20190613/1232522.html