如何删除 Android 中不需要的重叠
我正在尝试制作一个 Android 界面,但我在视图方面遇到了一些重叠问题。
这是我的代码。它在一个选项卡中,但我把选项卡部分剪掉了。如果你需要的话我会添加的。
更新:我忘了写我有很多 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>
这就是它的输出。正如您所看到的,在底部,文本位于按钮后面,但我希望它们有两种不同的布局
I am trying to make an Android interface, but I have a little overlapping issue with the views.
Here is my code. It is in a Tab, but I cut the Tab-part away. If you need it, I'll add it.
UPDATE: I forgot to write that I have a lot of TextView, not only one
<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>
And this is what it outputs. As you can see, in the bottom, the text goes behind the button, but I want to have them in two different layouts
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将其相对放置在按钮上方。
Try to position it relatively above the button.
除非绝对必要,否则不要使用RelativeLayout。曾经。我知道这不是一个流行的观点,但我就是这么告诉大家的。
我假设您希望滚动条占据尽可能多的空间,然后将按钮放在底部?
我认为您可以将 LinearLayout 转储到 ScrollView 中,假设您只有 1 个子级(TextView)
Don't use RelativeLayout unless you absolutely have to. Ever. I know that's not a popular opinion, but that's what I tell everybody.
I assume you want the scroll to take up as much space as possible, then have the button at the bottom?
I think you can dump the LinearLayout inside the ScrollView, assuming you only have 1 child (the TextView)