Android 程式開發:(一)詳解活動 —— 1.3 隱藏Activity的標題

如果願意的話,可以把Activity的標題欄給隱藏瞭。隻需要調用requestWindowFeature()方法,同時傳遞Window.FEATURE_NO_TITLE常量。
 
package net.horsttnann.Activity101; 
 
import net.horsttnann.Activity101.R; 
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); 
    } 

package net.horsttnann.Activity101;
 
import net.horsttnann.Activity101.R;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
 
public class Activity101Activity extends Activity {
    String tag = "Lifecycle"; www.aiwalls.com
 
    /** 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);
    }
}
 
 


摘自 manoel的專欄
 
 

發佈留言