安卓去掉标题栏的三种方法

    xiaoxiao2021-08-17  144

    安卓中有三种方法去掉标题栏。

    1.在代码里实现(Activity中)

    this.requestWindowFeature(Window.FEATURE_NO_TITLE);

    注意的是代码必须要放在setContentView(R.layout.activity_XX);前面

    2.在AndroidManifest.xml里面实现

    <application android:icon="@drawable/icon"    android:label="@string/app_name"    android:theme="@android:style/Theme.NoTitleBar">

    3.在style.xml文件里定义,然后面manifest.xml中引用。

    style.xml

     <?xml version="1.0" encoding="UTF-8" ?>   <resources>       <style name="notitle">           <item name="android:windowNoTitle">true</item>       </style>    </resources>

    AndroidManifest.xml

    <application android:icon="@drawable/icon"            android:label="@string/app_name"            android:theme="@style/notitle">

    转载请注明原文地址: https://ju.6miu.com/read-676560.html

    最新回复(0)