Android 3.2 remove title from action bar

前端 未结 2 1229
一生所求
一生所求 2021-01-02 09:06

I\'m working with eclipse, android 3.2. and a virtual machine running android x86. (v3.2)

I use the Holo theme and I want to remove the action bar title and icon. So

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-02 09:37

    I got around this by setting the "NoActionBar" holo theme in the android manifest and then setting the normal holo theme in onCreate().

    Step 1: In styles.xml, added a custom theme resource.

    
        
    
    

    Step 2: In my android manifest file I set the theme for the application and the "NoActionBar" holo theme for the startup activity.

    
      ...
    

    Step 3: In the startup activity's onCreate()...

    @Override
    public void onCreate()(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setTheme(R.style.CustomTheme); // Set the custom theme which has the action bar.
        ActionBar actionBar = getActionBar();
        ...
    

提交回复
热议问题