简体   繁体   中英

Getting rid of the Android Action bar.

When I create an android app this is generated automatically:

在此处输入图片说明

How do I get rid of this? Its ugly

EDIT

    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point size = new Point();
    display.getSize(size); 
    screenWidth = size.x;
    screenHeight = size.y;

you can try this :

requestWindowFeature(Window.FEATURE_NO_TITLE);

Note that this has to be called before setContentView(XYZ_xml)

There are other Window Features too, like no action bar and no title etc. See the javadoc for more help

you can also add this to work with xml like this :

android:theme="@android:style/Theme.NoTitleBar

尝试将其添加到清单的<application>标签中:

android:theme="@android:style/Theme.NoTitleBar"

在您的活动中,在setContentView()之前使用:

requestWindowFeature(Window.FEATURE_NO_TITLE);

try applying the theme to your activity in your manifest. You might have to change the theme depending on your support library:

android:theme="@android:style/Theme.NoTitleBar

Add Theme to you manifest like others have said. Avoid putting code in your java activity file instead because if you do that, when you run your application you will see the action bar for a very short duration (enough to notice it) before it goes away.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM