Android布局优先级
我的xml代码:Android布局优先级,android,android-relativelayout,Android,Android Relativelayout,我的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"
<?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
另一个问题是为什么seekbar没有点击
我发现布局的优先级是由建立顺序决定的?
但是seekbar的问题仍然没有解决。回答问题的第一部分。
android:layout\u width=“fill\u parent” android:layout\u height=“fill\u parent” android:layout\u centerInParent=“true”> 内部relativeLayout的可见性设置为不可见。请将其删除 您已经为seekbar提供了android:clickable=“。也许这就是它不起作用的原因。 把它拿开试试
希望这对您有所帮助。回答问题的第一部分。
android:layout\u width=“fill\u parent” android:layout\u height=“fill\u parent” android:layout\u centerInParent=“true”> 内部relativeLayout的可见性设置为不可见。请将其删除 您已经为seekbar提供了android:clickable=“。也许这就是它不起作用的原因。 把它拿开试试 希望这对你有帮助。试试这个
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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" >
<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="true"/>
</RelativeLayout>
<VideoView
android:id="@+id/videoView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</LinearLayout>
在运行时,您还可以更改
mylayout.setVisibilty(View.GONE)...
试试这个
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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" >
<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="true"/>
</RelativeLayout>
<VideoView
android:id="@+id/videoView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</LinearLayout>
在运行时,您还可以更改
mylayout.setVisibilty(View.GONE)...
当谈到你的seekbar时,这可能是一个可能的答案:Set
android:clickable="true"
在java代码中,尝试放置一个事件侦听器。对于事件侦听器
当涉及到布局时,您可以尝试使用线性布局,然后在其中嵌套一个相对布局。您可能需要稍微更改一下xml 说到你的seekbar,这可能是一个可能的答案:Set
android:clickable="true"
在java代码中,尝试放置一个事件侦听器。对于事件侦听器
当涉及到布局时,您可以尝试使用线性布局,然后在其中嵌套一个相对布局。您可能需要稍微更改一下xml 我只想在视频视图触动时显示相对图像2。所以我把它初始化为不可见。我只想在视频视图处于触摸状态时显示相对值。所以我把它命名为隐形。