PopupWindow + RecyclerView实现上下滑动框功能

  

本文实例为大家分享了PopupWindow + RecyclerView实现上下滑动框功能的具体代码,供大家参考,具体内容如下

  

1。新建一个适配器继承自RecyclerView.Adapter

        包aud.hik.com.audiorecordtool;      进口android.support.v7.widget.RecyclerView;   进口android.view.LayoutInflater;   进口android.view.View;   进口android.view.ViewGroup;   进口android.widget.TextView;      进口并不知道;      公开课FileListAdapter延伸RecyclerView.Adapter{   私人最终字符串标签=癋ileListAdapter”;   私人ListmFileList=零;   私人>   私人空间showPopupWindow () {   视图视图=LayoutInflater.from(这).inflate (R.layout.pop_window, null);//初始化列表数据   mVecFile=getFileName (TEXT_READ);//初始化RecyclerView   RecyclerView recyslerview=(RecyclerView) view.findViewById (R.id.recycler_view);//创建LinearLayoutManager对象这里使用LinearLayoutManager是线性布局的意思   LinearLayoutManager layoutmanager=new LinearLayoutManager(这个);//设置RecyclerView布的局   recyslerview.setLayoutManager (layoutmanager);//设置适配器   FileListAdapter适配器=new FileListAdapter (mVecFile);      适配器。setOnItemClickListener(新FileListAdapter.OnItemClickListener () {//@Override//公共voidbrush: xml; ">   & lt; & # 63; xml version=" 1.0 " encoding=" utf - 8 " & # 63;比;   & lt; LinearLayout xmlns: android=" http://schemas.android.com/apk/res/android "   android: layout_width=" match_parent "   android: layout_height=" wrap_content "   面向android:="水平"   android:背景=" @color/colorPrimaryDark”   android: layout_margin=? dp”比;      & lt; TextView   android: id=癅 + id/file_name”   android: layout_width=" match_parent "   android: layout_height=" wrap_content "   android:输入textColor=" @color/colorWhite”   android: textSize=" 30 sp "/比;      & lt;/LinearLayout>      

4. pop_window.xml         & lt; & # 63; xml version=" 1.0 " encoding=" utf - 8 " & # 63;比;   LinearLayout & lt;   xmlns: android=" http://schemas.android.com/apk/res/android "   android: layout_width=" match_parent "   android: layout_height=癿atch_parent”比;      & lt; android.support.v7.widget.RecyclerView   android: id=癅 + id/recycler_view”   android: layout_width=" match_parent "   android: layout_height=癿atch_parent”比;   & lt;/android.support.v7.widget.RecyclerView>   & lt;/LinearLayout>      

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
  

PopupWindow + RecyclerView实现上下滑动框功能