全屏显示主要是设置下面这两个属性:
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.TYPE_STATUS_BAR,
WindowManager.LayoutParams.TYPE_STATUS_BAR);
注:以上是使用android-sdk-windows-1.1_r1版本的SDK,其它版本参考相应的Documens
下面给出一个简单的例子:
package com.android.hello;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.TYPE_STATUS_BAR,
WindowManager.LayoutParams.TYPE_STATUS_BAR);
TextView tv = new TextView(this);
tv.setText("Hello Android!!");
setContentView(tv);
}
}
转载于:https://blog.51cto.com/01258/789386