Custom Translucent Android ActionBar

前端 未结 7 994
梦如初夏
梦如初夏 2020-11-29 16:19

I\'ve been scouring the interwebs (e.g. Android documentation, answers here, etc.) for the answer to what I thought would be a fairly trivial question. How do you achieve a

7条回答
  •  遥遥无期
    2020-11-29 16:26

    Step I : Firstly, Set your theme at styles.xml

        
    

    Step II : Second, you have to set theme to your activity at AndroidManifest.xml

        
    

    Step III : Now, In your activity layout file set like this:

        
            
        
    

    Finally, You can set it in your activity.

        Toolbar tool_bar = findViewById(R.id.tool_bar);
        setSupportActionbar(tool_bar);
        getSupportActionbar().setTitle("Your actionbar title");
        getSupportActionbar().setDisplayHomeAsUpEnabled(true);
    

    That's all, You'll get result with transparent Actionbar. Also, Here if you want to display drawer toggle button and menu, It'll show them.

提交回复
热议问题