Android horizontal ListView by RecyclerView

Introduction

Horizontal listview is special view in Android. In the part, developers need other library to implement horizontal listview.

Currently we only need RecyclerView, it is a library of Android SDK. Moreover, it is very easy to use.

How to use

    1. Add RecyclerView library to project
      Screen Shot 2016-01-07 at 11.53.55
    2. Sample code of Android
      You can see detail of sample code in this link of Android website
    3. How to draw horizontal listview
      After two above steps, we need to config to draw horizontal listview.
LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
this.recyclerView.setLayoutManager(layoutManager);

Conclusion

In summary, RecyclerView is a new library to replace ListView, GridView, or StaggeredGridView. We don’t need to use other library to implement above views. RecyclerView is powerful and lightweight library for Android developer.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s