androidtextviewandroid-recyclerviewflowlayout

Does anyone know how to do flow layout using RecyclerView?


Does anyone know how to do flow layout using RecyclerView?

How to change span count dynamically?

Answer :

Like this


Solution

  • Here is the full example of using custom Library which acts like List GitHubLibrary TagLayout

    mFlowLayout.setAdapter(new TagAdapter<String>(mVals) { @Override public View getView(FlowLayout parent, int position, String s) { TextView tv = (TextView) mInflater.inflate(R.layout.tv, mFlowLayout, false); tv.setText(s); return tv; } });

    Using below code you can pre set selection you wanted:-

    mAdapter.setSelectedList(1,3,5,7,8,9);
    

    Will show result like below:-

    enter image description here