Android布局优先级
我的 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:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:visibility="invisible">
<ImageButton
android:id="@+id/video_playback_pause"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<SeekBar
android:id="@+id/seekbar_video"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_below="@id/video_playback_pause" android:clickable=""/>
</RelativeLayout>
<VideoView
android:id="@+id/videoView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true" />
</RelativeLayout>
现在,RelativeLayout 和 VideoView 覆盖。 VideoView 显示,RelativeLayout 隐藏。 如何将RelativeLayout放在VideoView的顶部?
另一个问题是为什么seekbar没有点击?
我发现布局的优先级是由建立顺序决定的? 但seekbar的问题仍然没有解决。
My xml code:
<?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:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:visibility="invisible">
<ImageButton
android:id="@+id/video_playback_pause"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<SeekBar
android:id="@+id/seekbar_video"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_below="@id/video_playback_pause" android:clickable=""/>
</RelativeLayout>
<VideoView
android:id="@+id/videoView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true" />
</RelativeLayout>
Now whe RelativeLayout and VideoView override.
the VideoView is show, and the RelativeLayout is hidden.
How to make the RelativeLayout on the top of VideoView?
Another problem is why the seekbar did not click?
I find that the priority of layout is decide by establish order?
But the problem of seekbar is still not resolve.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
试试这个...
编辑:
您可以使用如下的可见性属性
在运行时您也可以更改
Try this...
EDIT:
You can use the visibilty property as below
At run time also you can change
当谈到你的搜索栏时,这可能是可能的答案:设置
并在你的java代码中,尝试放置一个事件监听器。对于事件侦听器,http://developer.android.com/guide/topics /ui/ui-events.html
当涉及到布局时,您可以尝试使用线性布局,然后在其中嵌套相对布局。您可能需要稍微更改一下 xml。
When it comes to your seekbar, this could be the possible answer: Set
and in your java code, try putting an Event Listener. For Event Listeners, http://developer.android.com/guide/topics/ui/ui-events.html
When it comes to your layout, you can try using a Linear Layout and then nest a Relative Layout inside it. You might have to change your xml a bit.
回答问题的第一部分。
安卓:layout_width =“fill_parent”
安卓:layout_height =“fill_parent”
android:layout_centerInParent="true">
内部relativeLayout的可见性设置为不可见。将其删除。
您已为搜索栏提供了android:clickable=""。可能这就是它不起作用的原因。
删除它并尝试。
希望这会对您有所帮助。
Answer for the first part of question.
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true">
The inner relativeLayout's visibility is set to invisible.Remove it.
You have provided android:clickable="" for seekbar. May be thats why its not working.
Remove that and try.
Hope this will help you.