从 Android 清单文件中删除以下行。
android:theme="@android:style/Theme.Black.NoTitleBar" 并检查 .
希望它会帮助你。
这是我用来检查它的代码。
public class Main extends Activity {
Button magic,button1,button2;
TextView display;
int random;
private Long startTime=System.currentTimeMillis();
private Handler handler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ssss);
button1=(Button)findViewById(R.id.button1);
button2=(Button)findViewById(R.id.button2);
button1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
goFullscreen();
}
});
button2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
goNonFullscreen();
}
});
}
public void goFullscreen() {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
this.findViewById(android.R.id.content).requestLayout();
}
public void goNonFullscreen() {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
this.findViewById(android.R.id.content).requestLayout();
}