2
我试图在多个TextView
和一些按钮组成的Android中实现布局。我想要其中一个TextView
(它是我正在实现的游戏的日志)占用它拥有的所有可用空间,如果显示的文本太多,可以滚动。不过,我似乎无法得到它的下方没有覆盖的观点,当它膨胀 - 相反,它停在屏幕的底部:使TextView展开而不覆盖其他视图
在这个截图中,有一个“记分牌”的TextView ,“手”TextView,“日志”TextView和带有几个按钮的LinearLayout。所有TextView
s都有动态长度,但前两个不应占用超过几行。麻烦的是,日志扩展并覆盖它下面的按钮(在正面,它是可滚动的)。你能告诉我如何解决这个问题吗?
这里的布局XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/scoreboard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="Scoreboard" />
<TextView
android:id="@+id/handinfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/scoreboard"
android:text="Hand" />
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button
android:id="@+id/stay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:text="Stay" />
<Button
android:id="@+id/leave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:text="Leave" />
<Button
android:id="@+id/pay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:text="Pay" />
<Button
android:id="@+id/payWithWild"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:text="Pay Wild" />
<Button
android:id="@+id/dontPay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:text="Don't Pay" />
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/handinfo" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/log"
android:text="" />
</ScrollView>
</RelativeLayout>
那么简单。它的工作原理,谢谢! – 2012-03-31 10:34:49