gpt4 book ai didi

java - Fading ActionBar Lib 的自定义布局

转载 作者:行者123 更新时间:2023-11-29 21:26:57 27 4
gpt4 key购买 nike

我在我的 Activity 中使用 Fading 操作栏库,但我找不到为操作栏设置自定义布局的方法。我只能在这个库中为我的操作栏设置一个可绘制对象,我尝试查看内部库代码,但它并没有太大帮助......无论如何都可以做到这一点。

这是它通常的工作方式:

         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);

配置你的action bar & 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);

关于java - Fading ActionBar Lib 的自定义布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20120769/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com