在隐藏标题的ActionBar滞后标题、ActionBar

2023-09-12 21:47:51 作者:该用户已成仙

我使用了 ActionBarSherlock 我的应用程序,这是code我用它来隐藏标题动作条

I'm using the ActionBarSherlock for my application and this is the code I use to hide the Title of ActionBar :

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayUseLogoEnabled(true);
    setContentView(R.layout.main_fragment);
}

这样做的问题是,当应用程序启动时有很短的时间量,当标志标题同时显示。这看起来真难看,我怎样才能摆脱呢?

The problem with this is that when the application starts there is a short amount of time when the Logo and Title are shown simultaneously. This looks really ugly, How can I get rid of that?

推荐答案

这是我的解决方案,我们需要定义一个新的风格,并在清单中声明它

This is my solution, we need to define a new style and declare it in the Manifest

<style name="VibhinnaTheme" parent="Theme.Sherlock.Light.ForceOverflow">
    <item name="android:actionBarStyle">@style/VibhinnaTheme.ActionBar</item>
    <item name="actionBarStyle">@style/VibhinnaTheme.ActionBar</item>
</style>

<style name="VibhinnaTheme.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid">
    <item name="android:displayOptions">showHome|useLogo</item>
    <item name="displayOptions">showHome|useLogo</item>
</style>

这个链接是有帮助的:LINK

 
精彩推荐
图片推荐