How to get rid of the program name bar at the top of the application?

爱⌒轻易说出口 提交于 2021-02-18 10:01:53

问题


i would like to get rid of the defualt grey bar which apears at the top of my application. I just can't seem to find the attribute or setting to do so. how can this be achived? thanks


回答1:


Use android:theme="@android:style/Theme.NoTitleBar", either for this specific <activity> element in your manifest, or for the whole <application> element if you want it gone for all of them. Here's a FAQ entry about it.




回答2:


I tried the manifest method but for some reason it wasn't working. However using the .java method as described here worked.

requestWindowFeature(Window.FEATURE_NO_TITLE);



回答3:


Open app/src/main/res/values/styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
    </style>

</resources>



回答4:


A good article why you should avoid removing the title bar from an app by Googler Reto Meier: http://blog.radioactiveyak.com/2010/07/how-to-display-android-status-bar-in.html

Read and rethink if you really need to remove the title bar from your app.



来源:https://stackoverflow.com/questions/3526848/how-to-get-rid-of-the-program-name-bar-at-the-top-of-the-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!