Maclaren
Maclaren

Reputation: 289

Android custom header

I am trying to replicate the actionBar/header(The blue area) for my app. I would like it to do exactly what is done in that image, except the last icon on the right I would prefer to be the menu (three dots)

After doing some research people have used AcitonBarActivity and customized the acitonBar, but that was deprecated since April 2015. Looking further into this, people have suggested to use Toolbar and actionBar is a subset of that.

Now I am don't know where to start. All I want to do is replicate the header area in the image below.

Note: The app right now only extends Activity and not ActionBarActivity. Also I will be building with minimum version Ice cream sandwhich (4.0)

enter image description here

Upvotes: 1

Views: 2724

Answers (2)

Rod_Algonquin
Rod_Algonquin

Reputation: 26198

I would recommend using the new Appcompat and Design library that google has to offer.

You can start by added this in your gradle dependencies in your app:

compile 'com.android.support:design:22.2.0' compile 'com.android.support:appcompat-v7:22.2.0'

When you are ready you can go to this sample project and the link documentation for each new design widgets.

On what you want is easy to make just create a layout that wraps the toolbar in CollapsingToolbarLayout, just follow the sample project.

Upvotes: 1

jihoon kim
jihoon kim

Reputation: 1290

try to extend AppCompatActivity and use Toolbar.

here is reference site.

http://inthecheesefactory.com/blog/android-design-support-library-codelab/en

Upvotes: 1

Related Questions