2013-11-21 51 views
1

我在我的活动中使用淡入淡出操作栏库,但我找不到一种方法来设置自定义布局到操作栏.i只能设置一个可拖动到我的操作栏中图书馆,我试图寻找内部库代码,但它并没有太大的帮助............有没有办法做到这一点。褪色ActionBar Lib的自定义布局

这里是如何它通常工作:

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

回答

1

试试这个,它工作在我的身边

虚增您的自定义操作栏

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

配置你的动作条& setCustomView

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

然后使用FadingActionbar代码

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

是的,它的工作原理! :) –