Android how to get AppCompat.Translucent type theme with support actionbar?

后端 未结 4 1119
天涯浪人
天涯浪人 2020-12-07 14:28

I would like to add the support actionbar to one of my activities, I previously had been using the theme.translucent with this activity but in order to make the support acti

4条回答
  •  再見小時候
    2020-12-07 15:00

    Cameron's answer is a nice hack , but it produced a floating action bar and tinted my status bar, which i didn't wanted . So i added more xml attributes for making status bar transparent(for sdk >=19) and used java code for making action bar invisible.

    mainActivity.java :

    public class MainActivity extends AppCompatActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            getSupportActionBar().hide();
         ...
        }
         ...
    }
    

    styles.xml

    
    

    manifest.xml

    
    
    
        
            ...
        
    
    

提交回复
热议问题