有两种方法:

1、在AndroidManifest.xml的配置文件里面的<activity>标签添加属性:

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

如:

<activity
android:name="com.wangfeng.wfgogofish.ui.FirstActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

2.在Activity的onCreate()方法中的super()和setContentView()两个方法之间加入下面两条语句:

this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏

this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息栏

如:

  @Override

    public void onCreate(Bundle savedInstanceState) {

       super.onCreate(savedInstanceState);

       requestWindowFeature(Window.FEATURE_NO_TITLE); //设置无标题

       getWindow().setFlags(WindowManager.LayoutParams.FILL_PARENT, WindowManager.LayoutParams.FILL_PARENT);  //设置全屏  

       setContentView(R.layout.image_list_layout);

    }

 

相关文章:

  • 2022-12-23
  • 2021-05-23
  • 2022-12-23
  • 2021-10-22
  • 2022-12-23
  • 2021-08-25
  • 2021-11-15
猜你喜欢
  • 2022-12-23
  • 2022-02-11
  • 2021-06-06
  • 2022-12-23
  • 2022-12-23
  • 2021-09-07
  • 2022-12-23
相关资源
相似解决方案