当前位置:操作系统 > 安卓/Android >>

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.zzzyk.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的专栏
 
 

补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,