首页 > 程序开发 > 移动开发 > Android >

Android新手入门教程(三):理解Activityの隐藏标题栏

2012-03-24

如果愿意的话,我们可以把Activity的标题栏给隐藏了。如果想这么干的话,只需使用requestWindowFeature()方法,并传递Window.FEATURE_NO_TITLE常量值。[java]package net.learn2develop.Activity101;import an...

如果愿意的话,我们可以把Activity的标题栏给隐藏了。如果想这么干的话,只需使用requestWindowFeature()方法,并传递Window.FEATURE_NO_TITLE常量值。

[java]
package net.learn2develop.Activity101;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;

public class Activity101Activity extends Activity {
String tag = "Lifecycle";

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// ---hides the title bar---
requestWindowFeature(Window.FEATURE_NO_TITLE);

setContentView(R.layout.main);
Log.d(tag, "In the onCreate() event");
}
}
package net.learn2develop.Activity101;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;

public class Activity101Activity extends Activity {
String tag = "Lifecycle";

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// ---hides the title bar---
requestWindowFeature(Window.FEATURE_NO_TITLE);

setContentView(R.layout.main);
Log.d(tag, "In the onCreate() event");
}
}
效果图:

\

摘自 horsttnann

相关文章
最新文章
热点推荐