Java 用于淡入ActionBar库的自定义布局
我在我的活动中使用淡入淡出的动作栏库,但我找不到为动作栏设置自定义布局的方法。我只能在此库中为我的动作栏设置一个可绘制的,我尝试查看库内代码,但没有太大帮助。。。。。。。。。。。。有没有办法做到这一点 以下是它通常的工作原理:Java 用于淡入ActionBar库的自定义布局,java,android,eclipse,android-library,Java,Android,Eclipse,Android Library,我在我的活动中使用淡入淡出的动作栏库,但我找不到为动作栏设置自定义布局的方法。我只能在此库中为我的动作栏设置一个可绘制的,我尝试查看库内代码,但没有太大帮助。。。。。。。。。。。。有没有办法做到这一点 以下是它通常的工作原理: FadingActionBarHelper helper = new FadingActionBarHelper() .actionBarBackground(R.drawable.ab_background) .head
FadingActionBarHelper helper = new FadingActionBarHelper()
.actionBarBackground(R.drawable.ab_background)
.headerLayout(R.layout.header)
.contentLayout(R.layout.activity_profile);
看看上面提到的。它很简单,你会理解这个库是如何工作的。试试这个,它在我这边起作用 充气您的自定义操作栏
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);
然后使用FadingAction条形码
FadingActionBarHelper helper = new FadingActionBarHelper()
.actionBarBackground(R.drawable.ab_background)
.headerLayout(R.layout.header)
.contentLayout(R.layout.activity_profile);
我使用与ActionBar Compat库兼容的FadingActionBar版本。你可以在电视上找到它