android – 如何播放当前焦点在回收站视图中的视频视频视频

android – 如何播放当前焦点在回收站视图中的视频视频视频,第1张

概述在我的应用程序中有一个带有视频视图的回收器视图,我想自动播放滚动时完全聚焦的特定视频视图. RecyclerView rv_featureList;private View currentFocusedLayout, oldFocusedLayout;@Overridepublic void onCreate(Bundle instanceState) { rv_featuredL 在我的应用程序中有一个带有视频视图的回收器视图,我想自动播放滚动时完全聚焦的特定视频视图.解决方法
RecyclerVIEw rv_featureList;private VIEw currentFocusedLayout,oldFocusedLayout;@OverrIDepublic voID onCreate(Bundle instanceState) {    rv_featuredList.addOnScrollListener(new RecyclerVIEw.OnScrollListener() {        @OverrIDe        public voID onScrollStateChanged(RecyclerVIEw recyclerVIEw,int newState) {            super.onScrollStateChanged(recyclerVIEw,newState);            if (newState == AbsListVIEw.OnScrollListener.SCRolL_STATE_IDLE) {                //get the recyclervIEw position which is completely visible and first                int positionVIEw = ((linearlayoutmanager) rv_featuredList.getLayoutManager()).findFirstCompletelyVisibleItemposition();                Log.i("VISISBLE",positionVIEw + "");                if (positionVIEw >= 0) {                    if (oldFocusedLayout != null) {                        //Stop the prevIoUs vIDeo playback after new scroll                        VIDeoVIEw vv_dashboard = (VIDeoVIEw) oldFocusedLayout.findVIEwByID(R.ID.vv_dashboard);                        vv_dashboard.stopPlayback();                    }                    currentFocusedLayout = ((linearlayoutmanager) rv_featuredList.getLayoutManager()).findVIEwByposition(positionVIEw);                    VIDeoVIEw vv_dashboard = (VIDeoVIEw) currentFocusedLayout.findVIEwByID(R.ID.vv_dashboard);                    //to play vIDeo of selected recylervIEw,vIDeosData is an array-List which is send to recyclervIEw adapter to fill the vIEw. Here we getting that specific vIDeo which is displayed through recyclervIEw.                    playVIDeo(vIDeosData.get(positionVIEw));                    oldFocusedLayout = currentFocusedLayout;                }            }        }    });}
总结

以上是内存溢出为你收集整理的android – 如何播放当前焦点在回收站视图中的视频视频视频全部内容,希望文章能够帮你解决android – 如何播放当前焦点在回收站视图中的视频视频视频所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1130226.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存