java - How to use some of ListView method in RecyclerView? -


i'm used recyclerview show , sort levels. because listview has speed did not use listview , use recyclerview.
therefore, need of listviewmethods, methods has setscrollposition , setonitemselect .

my recyclerview adapter codes :

public class levels_card_adapter extends     recyclerview.adapter<levels_card_adapter.viewholder> { private static string[] adapter_levels_number;  public levels_card_adapter(string[] adapter_levels_num_data) {     adapter_levels_number = adapter_levels_num_data;    }  @override public levels_card_adapter.viewholder oncreateviewholder(viewgroup parent,                                                          int viewtype) {      view itemlayoutview = layoutinflater.from(parent.getcontext()).inflate(             r.layout.levels_recycler_layout, null);       viewholder viewholder = new viewholder(itemlayoutview);     return viewholder; }  @override public void onbindviewholder(viewholder viewholder, int position) {      viewholder.adapter_levels_text.settext(adapter_levels_number[position].tostring());      viewholder.adapter_levels_version = adapter_levels_number[position];    }  @override public int getitemcount() {     return adapter_levels_number.length; }  public static class viewholder extends recyclerview.viewholder {      public textview adapter_levels_text;      public string adapter_levels_version;       public viewholder(view itemlayoutview) {         super(itemlayoutview);          adapter_levels_text = (textview) itemlayoutview                 .findviewbyid(r.id.level_thumnail_text);          itemlayoutview.setonclicklistener(new view.onclicklistener() {              @override             public void onclick(view v) {                  intent question_page_intent = new intent(v.getcontext(), com.tellfa.braingame.activities.question_page.class);                 v.getcontext().startactivity(question_page_intent);              }         });      }  } 

activity code :

public class play_page extends actionbaractivity {  private recyclerview play_recycler_levels; private recyclerview.adapter play_adapter_levels; private textview play_header_text; private tellfa_textview play_thumbnail_levels_num, play_time_level_num; private discreteseekbar play_scroll_seekbar; private com.github.jorgecastilloprz.fabprogresscircle fb; private context context; private listview play_list_levels;  public static string[] levels_number = {"1", "2", "3", "4", "5", "6", "7", "8", "9",         "10", "11", "12", "13", "14", "15", "16"};  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.play__page);      getwindow().setflags(windowmanager.layoutparams.flag_fullscreen,             windowmanager.layoutparams.flag_fullscreen);      ///////////// font style     typeface yekan_font = typeface.createfromasset(getassets(), "fonts/yekan.ttf");      play_header_text = (textview) findviewbyid(r.id.header_play_text);     play_header_text.settypeface(yekan_font);     /////////////      play_thumbnail_levels_num = (tellfa_textview) findviewbyid(r.id.level_thumnail_text);      play_time_level_num = (tellfa_textview) findviewbyid(r.id.time_levels_num);      ///////////// seekbar     play_scroll_seekbar = (discreteseekbar) findviewbyid(r.id.scroll_seekbar_play);        ///////////// recycler view     play_recycler_levels = (recyclerview) findviewbyid(r.id.levels_recycler);      play_recycler_levels.sethasfixedsize(true);      play_recycler_levels.setlayoutmanager(new linearlayoutmanager(this));      play_adapter_levels = new levels_card_adapter(levels_number);      play_recycler_levels.setadapter(play_adapter_levels);      ////////////      /*     //////////// list     com.tellfa.braingame.adapters.levels_list_adapter adapter=new com.tellfa.braingame.adapters.levels_list_adapter             (this, levels_number);     play_list_levels=(listview)findviewbyid(r.id.list);     play_list_levels.setadapter(adapter);     play_list_levels.setscrollingcacheenabled(true);         ///////////     */      framelayout containerlayout = (framelayout) findviewbyid(r.id.rel_id);     headeranimator animator = new headeranimator(this);      stikkyheaderbuilder.stickto(play_recycler_levels)             .setheader(r.id.header, containerlayout)             .minheightheader(250)             .animator(animator)             .build();      ///////////// refresh     final swiperefreshlayout play_refresh = (swiperefreshlayout) findviewbyid(r.id.refresh_play_layout);     play_refresh.setcolorschemeresources(r.color.refresh1, r.color.refresh2, r.color.refresh3, r.color.refresh4, r.color.refresh5);     play_refresh.setonrefreshlistener(new swiperefreshlayout.onrefreshlistener() {         @override         public void onrefresh() {             play_refresh.setrefreshing(true);          }     });  } 

how can make method?
this important me

what setscrollx() , recyclerview.onitemtouchlistener?

public void setscrollx (int value)

set horizontal scrolled position of view.

recyclerview.onitemtouchlistener

an onitemtouchlistener allows application intercept touch events in progress @ view hierarchy level of recyclerview before touch events considered recyclerview's own scrolling behavior.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -