user1631100
user1631100

Reputation: 105

Custom layout for Fading ActionBar Lib

I'm using Fading action bar library in my activity but i can't find a way to set a custom layout to the action bar .i can only set a drawable to my action bar in this library, i tried looking inside libraries code but it didn't help so much ............ is there anyway to do that.

here is how it usually works :

         FadingActionBarHelper helper = new FadingActionBarHelper()
        .actionBarBackground(R.drawable.ab_background)
        .headerLayout(R.layout.header)
        .contentLayout(R.layout.activity_profile);

Upvotes: 1

Views: 1252

Answers (3)

Aj 27
Aj 27

Reputation: 2427

I use a compatible version for FadingActionBar with the ActionBar Compat library. You can find it on https://github.com/felixWackernagel/FadingActionBar-Compat.

Upvotes: 1

Tan Tran
Tan Tran

Reputation: 176

try this, it works in my side

inflate your custom action bar

    final ViewGroup actionBarLayout = (ViewGroup) getLayoutInflater().inflate(
            R.layout.actionbar_layout,
            null);

config your action bar & setCustomView

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setCustomView(actionBarLayout);

then use FadingActionbar code

     FadingActionBarHelper helper = new FadingActionBarHelper()
    .actionBarBackground(R.drawable.ab_background)
    .headerLayout(R.layout.header)
    .contentLayout(R.layout.activity_profile);

Upvotes: 1

oscarthecat
oscarthecat

Reputation: 1841

take a look at this as FadingActionBar mentiond. It's simple and you will understand how the library workds.

Upvotes: 0

Related Questions