Android - 滚动时设置在另一个视图之上时出现视图问题
我创建了一个 ScrollView,其中有一个relativelayout。我使用 layout_alignParentBottom="true"
在relativelayout 的底部对齐了一个 TextView,并使用 "layout_above"
在 TextView 上方对齐了一个 ImageView。当我使用的设备的显示屏足够大而无需上下滚动时,布局效果非常好。当我在需要滚动才能看到 ImageView 和 TextView 的设备上进行测试时,ImageView 并未在 TextView 上方对齐。事实上我不知道它去了哪里,因为我在任何地方都看不到它。它可能位于 TextView 后面。当我使用软键盘向上编辑 EditText 时也会发生这种情况,这会导致relativelayout滚动。
有人知道这是怎么回事吗?
I've created a ScrollView with a RelativeLayout inside of it. I have a TextView aligned at the bottom of the RelativeLayout using layout_alignParentBottom="true"
and a ImageView above the TextView using "layout_above"
. The layout works perfect when I am on a device where the display is large enough to not have to scroll up and down. When I test it on devices where you need to scroll to see the ImageView and TextView the ImageView doesn't line up above the TextView. Actually I haven't a clue where it goes because I can't see it anywhere. It might be behind the TextView. This also happens when I'm editing an EditText with the Soft Keyboard up, which causes the RelativeLayout to scroll.
Anyone knows what's going on here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:对于相对布局,您指定
android:layout_alignParentTop="true"
,然后通过android:layout_below=""
将图像视图放置在其下方,然后将文本视图放置在图像视图。我想你可能会明白。Try this: for relative layout you specify
android:layout_alignParentTop="true"
and then place the image view below it byandroid:layout_below=""
and then the textview below the image view. I guess you might get it.