我有这样的布局:
...
<LinearLayout
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:orientation="horizontal"
android:gravity="center"
android:layout_height="60dp">
<TextView
android:text="@string/n_alb"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
<EditText
android:layout_width="wrap_content" <!-- ?? -->
android:layout_height="match_parent"/>
</LinearLayout>
...
我希望TextView
'的宽度为,wrap_content
而EditText
'的宽度填充父对象中其余的空间。
我知道我可以使用weightSum
,layout_weight
但是没有别的办法吗?
提前致谢
试试这个
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:gravity="center"
android:orientation="horizontal" >
<TextView
android:id="@+id/yourtextview"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/n_alb" />
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toRightOf="@+id/yourtextview" >
</EditText>
</RelativeLayout>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句