我正在尝试制作一个 Android 界面,但我有一些与 View 重叠的问题。
这是我的代码。它在一个标签中,但我把标签部分切掉了。如果你需要,我会添加。
更新:我忘了写我有很多 TextView,而不是只有一个
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ScrollView
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
<!-- A lot of TextView as the one above -->
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="@+id/InnerRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button
android:id="@+id/add"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_width="fill_parent"
android:text="@string/add" />
</RelativeLayout>
</RelativeLayout>
</FrameLayout>
这就是它的输出。如您所见,在底部,文本位于按钮后面,但我希望它们采用两种不同的布局
最佳答案
尽量将它放在按钮上方。
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ScrollView
android:orientation="vertical"
android:layout_above="@+id/InnerRelativeLayout" //Add this
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<TextView
android:text="welcome"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="@+id/InnerRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button
android:id="@+id/add"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_width="fill_parent"
android:text="@string/add" />
</RelativeLayout>
</RelativeLayout>
</FrameLayout>
关于android - 如何删除android中不需要的重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7997676/