Create Collapsing Toolbar Layout like Whatsapp in Android Application

download Create Collapsing Toolbar Layout like Whatsapp in Android Application

If you can't read please download the document

Transcript of Create Collapsing Toolbar Layout like Whatsapp in Android Application

Android :
Create Collapsing Toolbar Layout like Whatsapp in Android Application

http://pulse7.net/

*CollapsingToolbarLayout is a wrapper for Toolbar which implements a collapsing app bar. It is designed to be used as a direct child of a AppBarLayout.

*If you scroll the listview automatically toolbar gets hidden, like whatsapp.

http://pulse7.net/

*I will tell you steps for how to create Collapsing Toolbar Layout like Whatsapp in Android Application Follow steps:

1.First, add Support Design Library, Recyclerview and Cardview in gradle:

http://pulse7.net/

2.In activity_main, coordinator layout out will be the root element in layout file. Then in appbar layout add collapsing toobar laytout and toolbar and place your image inside collapsing toolbar. Add Recycler view and floating button outside appbar layout.

http://pulse7.net/Continue...

2.

http://pulse7.net/Continue...

2.

2.

http://pulse7.net/2.

3.In list view as we define row view, in the same way, we define our row view in Card view. Create layout file card_view.xml in resources/layout.

http://pulse7.net/

Continue...

http://pulse7.net/3.

4.Create model class Flower.java and add name and int id (for drawables) and crate constructor of Model class.

http://pulse7.net/

5.Now for attaching adapter to recyclerview, create java file CardAdapter.java and inflate card_view layout in onCreateViewHolder method.

http://pulse7.net/

Continue...

http://pulse7.net/5.

6.Now in MainActivity.java,set content view to R.layout.activity_main. Initialize toolbar, floatingAction button and collapsing toolbar layout in it.

*Create method initializeData() and create array list of flowers in it and call the constructor of Flower class and put title and image into it. Call this method before setting adapter.

http://pulse7.net/

6.

http://pulse7.net/

Continue...

6.

http://pulse7.net/Continue...

6.

http://pulse7.net/Continue...

7.Now execute application, we get this type of output:

http://pulse7.net/

Download Full Source Code And Subscribe (Facebook, Twitter, Google+) for more article

http://pulse7.net/

http://pulse7.net/

Click to edit the title text formatClick to edit Master title style

11/12/15

Click to edit the title text formatClick to edit Master title style

Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline LevelSixth Outline Level

Seventh Outline LevelClick to edit Master text styles

Second level

Third level

Fourth level

Fifth level

11/12/15