如何使视图布局填补剩余空间? [英] How to make layout with View fill the remaining space?
本文介绍了如何使视图布局填补剩余空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我设计我的应用程序的用户界面。我需要一个布局是这样的:
I'm designing my application UI. I need a layout looks like this:
(小于和>按钮)。问题是,我不知道如何来确保的TextView将填补剩余的空间,有两个按钮具有固定大小。
(< and > are Buttons). The problem is, I don't know how to make sure the TextView will fill the remaining space, with two buttons have fixed size.
如果我用FILL_PARENT的文本视图,无法显示在第二个按钮(>)。
If I use fill_parent for Text View, the second button (>) can't be shown.
感谢您的阅读。
推荐答案
如果你使用RelativeLayout的,你可以做这样的事情:
if you use RelativeLayout, you can do it something like this:
<RelativeLayout
android:layout_width = "fill_parent"
android:layout_height = "fill_parent">
<ImageView
android:id = "@+id/my_image"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_alignParentTop ="true" />
<RelativeLayout
android:id="@+id/layout_bottom"
android:layout_width="fill_parent"
android:layout_height = "50dp"
android:layout_alignParentBottom = "true">
<Button
android:id = "@+id/but_left"
android:layout_width = "80dp"
android:layout_height = "wrap_content"
android:text="<"
android:layout_alignParentLeft = "true"/>
<TextView
android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:layout_toLeftOf = "@+id/but_right"
android:layout_toRightOf = "@id/but_left" />
<Button
android:id = "@id/but_right"
android:layout_width = "80dp"
android:layout_height = "wrap_content"
android:text=">"
android:layout_alignParentRight = "true"/>
</RelativeLayout>
</RelativeLayout>
这篇关于如何使视图布局填补剩余空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文