一个视频视图被另一个视频视图阻止。
|
我的活动布局如下所示。基本上,我在左侧有一个列表视图菜单,并根据用户单击的菜单项在两个视频视图之间进行切换。
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<LinearLayout
xmlns:android=\"http://schemas.android.com/apk/res/android\"
android:id=\"@+id/activity_system_status\"
android:title=\"@string/system_status\"
android:layout_width=\"fill_parent\"
android:layout_height=\"fill_parent\"
android:orientation=\"horizontal\">
<LinearLayout
android:layout_width=\"fill_parent\"
android:layout_height=\"fill_parent\"
android:orientation=\"vertical\"
android:layout_weight=\"4\">
<ListView
android:id=\"@+id/list_video_feed\"
android:layout_width=\"fill_parent\"
android:layout_height=\"fill_parent\">
</ListView>
</LinearLayout>
<LinearLayout
android:id=\"@+id/linear_layout_live_video\"
android:layout_width=\"fill_parent\"
android:layout_height=\"fill_parent\"
android:orientation=\"vertical\"
android:layout_weight=\"1\">
<VideoView
android:id=\"@+id/video_view\"
android:layout_width=\"fill_parent\"
android:layout_height=\"fill_parent\"
android:layout_gravity=\"center\"
/>
</LinearLayout>
<LinearLayout
android:id=\"@+id/linear_layout_video_gallery\"
android:layout_width=\"fill_parent\"
android:layout_height=\"fill_parent\"
android:orientation=\"vertical\"
android:layout_weight=\"1\">
<Gallery
android:id=\"@+id/gallery\"
android:layout_width=\"fill_parent\"
android:layout_height=\"wrap_content\"
/>
<VideoView
android:id=\"@+id/archived_video_view\"
android:layout_width=\"fill_parent\"
android:layout_height=\"wrap_content\"
/>
</LinearLayout>
</LinearLayout>
在我的代码中,如果要从没有图库的视图中播放视频,则隐藏其他视频。
linearLayoutVideoGallery.setVisibility(GONE);
linearLayoutLiveVideo.setVisibility(VISIBLE);
playVideo();
问题在于,archived_video_view停留在顶部,只有图库隐藏。有小费吗?让我知道您是否需要任何其他信息。谢谢!
编辑:这是我的if语句,用于选择onCreate()中的菜单项。希望这会有所帮助。当我单击position == 1然后postion == 2时,画廊消失了,但archived_video_view仍然在那里暂停,因此我只能看到video_view的顶部,这是画廊过去的位置。
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
if (position==1) { //video gallery list item has been pressed
vvLive.stopPlayback();
linearLayoutLiveVideo.setVisibility(GONE);
linearLayoutVideoGallery.setVisibility(VISIBLE);
playArchivedVideo();
}
else if (position == 2) { //live video list item has been pressed
vvArchive.stopPlayback();
linearLayoutVideoGallery.setVisibility(GONE);
linearLayoutLiveVideo.setVisibility(VISIBLE);
playLiveVideo();
}
}
});
没有找到相关结果
已邀请:
1 个回复
痴浪墨