美文网首页
Android开发如何去除标题栏title

Android开发如何去除标题栏title

作者: chjxidian | 来源:发表于2019-12-11 08:56 被阅读0次

    去除标题栏title其实非常简单,他有两种方法,一种是在代码中添加,另一种是在AndroidManifest.xml中添加:
    1、在代码中实现:
    在此方法setContentView(R.layout.main)之前加入:
    requestWindowFeature(Window.FEATURE_NO_TITLE);标题栏就没有了。
    2、在AndroidManifest.xml中实现:
    注册Activity时加上如下的一句配置就可以实现。

    <activity  android:name=".Activity">
           android:theme="@android:style/Theme.NoTitleBar"
    </activity>
    
    /* 通过findViewById 构造三个对象*/
    mImageButton1 = (ImageButton) findViewById(R.id.image_Button );
    mButton1 = (Button) findViewById(R.id.normal_Button );
    mTextView1 = (TextView) findViewById(R.id.show_TextView);
    

    相关文章

      网友评论

          本文标题:Android开发如何去除标题栏title

          本文链接:https://www.haomeiwen.com/subject/auzngctx.html