【发布时间】:2012-03-23 23:41:33
【问题描述】:
我找不到解决方案。我设法解决了滚动视图不与底部的按钮+文本视图重叠的问题,但我仍然无法让滚动视图从屏幕顶部开始,而不是从按钮上方开始。
请注意,即使是底部的线性布局(按钮+文本视图)也不是我想要的。我找不到让所有东西都正确定位的方法。
Eclipse 也无济于事,因为 xml 的文本视图在我的鼠标下不断变化,使其非常烦人。我必须打开一个外部编辑器来编辑它。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|top" >
<LinearLayout
android:id="@+id/LinearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" >
<TextView
android:id="@+id/text_phrase"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="@string/play" />
</LinearLayout>
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/LinearLayout2"
android:layout_alignParentLeft="true"
android:layout_marginBottom="18dp" >
<LinearLayout
android:id="@+id/layout_player_checkboxes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:orientation="vertical" >
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CheckBox" />
</LinearLayout>
</ScrollView>
【问题讨论】:
-
你能告诉我你希望你的布局如何,否则图像会很棒
-
我看到的新stackoverflow不允许我轻松编辑:(我希望你能看到这个链接:i.imgur.com/RaOLE.png这是我想要的,但是通过上面的代码,我得到了三个“Heading3”锚定到下面的线性布局,而不是如图所示锚定到顶部。
-
好的,所以你想要这样的东西,标题的数量限制为三个,否则它将是动态的
-
这是一个滚动视图,带有一个充满复选框的线性布局。它们可以是从 1 到 20 甚至更多的任何数字。这就是我使用滚动视图的原因。