search

Home  >  Q&A  >  body text

android studio如何取消xml布局文件里面最上面的一条东西?

在布局文件的代码里面是没有的,一跑在真机上顶部就会出现一条白色的东西。请问怎么把它去掉》?

怪我咯怪我咯2772 days ago642

reply all(5)I'll reply

  • 阿神

    阿神2017-04-17 15:25:47

    Set the theme to NoActionBar and set it in style.xml:

    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    Then set the theme in the Activity in the AndroidManifest.xml file:

    android:theme="@style/AppTheme.NoActionBar"

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 15:25:47

    Baidu or Google search keyword "android cancel title"

    reply
    0
  • 阿神

    阿神2017-04-17 15:25:47

    It has nothing to do with the xml layout file. The white bar above is called the activity default title bar. It has a title bar by default. You can set the theme attribute of the activity (@xxx.NoTitleBar) or set the Window flag to FLAG_NO_TITLE before the activity setContentView

    reply
    0
  • PHPz

    PHPz2017-04-17 15:25:47

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
            setContentView(R.layout.xxxx);
        }

    reply
    0
  • 迷茫

    迷茫2017-04-17 15:25:47

    This position is also related to the style of the theme. Does the project example you are looking for use toolbar?

    reply
    0
  • Cancelreply