我正在使用以下代码创建包含文本视图和微调器的表布局。
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">
<TableRow>
<TextView
android:id="@+id/lblListHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginLeft="20dp"
android:layout_weight="1"
android:layout_marginRight="20dp"
android:layout_marginTop="20dp"
android:text="Form"
android:singleLine="true"
android:textColor="#000" />
<Spinner
android:id="@+id/spinner1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:drawable/btn_dropdown"
android:spinnerMode="dropdown"
android:entries="@array/action"/>
</TableRow>
</TableLayout>
问题在于“文本视图”和微调器的宽度不相等。当文本视图的大小较大时,微调器的大小将变小。我该如何解决这个问题?
将width
它们两个都更改为零而不是wrap_content
。
android:layout_width="0dp"
同时使用weight
和width
时,该width
属性将覆盖weight
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句