Android:RecyclerView中Item的VideoView预览图显示黑屏的解决办法
16lz
2021-01-23
布局文件如下:
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <zippler.cn.yuewu.component.FullVideoView android:background="#00ffffff" android:layout_width="match_parent" android:layout_height="match_parent" android:alpha="0" android:id="@+id/videoView" /> <ImageView android:translationZ="10dp" android:id="@+id/img" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitXY" android:contentDescription="@string/preloadVideoFrame" android:layout_alignParentTop="true" android:layout_alignParentStart="true" />RelativeLayout>
重点在于VideoView中需要设置background: android:background=”#00ffffff”,透明显示底部的ImageView
为了更好的用户体验,可以在onScrollStateChanged监听器case 0 中添加:
recyclerView.postDelayed(new Runnable() { @Override public void run() { ImageView img =mv.getImageView(); img.setVisibility(View.INVISIBLE); } },500);
更多相关文章
- adroid 现行布局水平居中位置
- Android百分比布局
- 完美解决Android Studio在写XML布局的时候没有了控件代码提示的
- Android 子控件高度超出父布局的限制
- android开发 使用uses-sdk 导致布局不一样解决
- android studio无法在可视化页面预览布局文件
- Android五大UI布局的特有属性
- 33、Android 中子fragment控制父对象改变布局
- 探索Android ConstraintLayout布局