android上面標題欄該多高,android 狀態列和標題欄具體是哪裡

時間 2021-08-30 09:42:40

1樓:匿名使用者

getwindow().getdecorview().getwindowvisibledisplayframe(rect);///取得整個檢視部分,注意,如果你要設定標題樣式,這個必須出現在標題樣式之後,否則會出錯

int top = rect.top;////狀態列的高度,所以rect.height,rect.width分別是系統的高度的寬度

view v = getwindow().findviewbyid(window.id_android_content);///獲得根檢視

int top2 = v.gettop();///狀態列標題欄的總高度,所以標題欄的高度為top2-top

int width = v.getwidth();///檢視的寬度,這個寬度好像總是最大的那個

int height = v.getheight();////檢視的高度,不包括狀態列和標題欄

如果只想取得螢幕大小,可以用

display display = getwindowmanager().getdefaultdisplay() ;

display.getwidth();

display.getheight();**見@overridepublic void onwindowfocuschanged(boolean hasfocus) {

// todo auto-generated method stub

super.onwindowfocuschanged(hasfocus);

rect frame = new rect();

getwindow().getdecorview().getwindowvisibledisplayframe(frame);

// 狀態列高度

int statusbarheight = frame.top;

view v = getwindow().findviewbyid(window.id_android_content);

int contenttop = v.gettop();

// statusbarheight是上面所求的狀態列的高度

int titlebarheight = contenttop - statusbarheight;

textview = (textview) findviewbyid(r.id.textview1);

textview.settext(標題欄的高度 + integer.tostring(titlebarheight) +

+ 標題欄高度 + statusbarheight +

+ 檢視的寬度 + v.getwidth()

+ + 檢視的高度(不包含狀態列和標題欄) + v.getheight());

2樓:創意木子

android 上面標題欄的高度設定要根據狀態列設定保持一致。具體設定如下:

getwindow().getdecorview().getwindowvisibledisplayframe(rect);///取得整個檢視部分,注意,如果你要設定標題樣式,這個必須出現在標題樣式之後,否則會出錯

int top = rect.top;////狀態列的高度,所以rect.height,rect.width分別是系統的高度的寬度

view v = getwindow().findviewbyid(window.id_android_content);///獲得根檢視

int top2 = v.gettop();///狀態列標題欄的總高度,所以標題欄的高度為top2-top

int width = v.getwidth();///檢視的寬度,這個寬度好像總是最大的那個

int height = v.getheight();////檢視的高度,不包括狀態列和標題欄

如果只想取得螢幕大小,可以用

display display = getwindowmanager().getdefaultdisplay() ;

display.getwidth();

display.getheight();**見@overridepublic void onwindowfocuschanged(boolean hasfocus) {

// todo auto-generated method stub

super.onwindowfocuschanged(hasfocus);

rect frame = new rect();

getwindow().getdecorview().getwindowvisibledisplayframe(frame);

// 狀態列高度

int statusbarheight = frame.top;

view v = getwindow().findviewbyid(window.id_android_content);

int contenttop = v.gettop();

// statusbarheight是上面所求的狀態列的高度

int titlebarheight = contenttop - statusbarheight;

textview = (textview) findviewbyid(r.id.textview1);

textview.settext(標題欄的高度 + integer.tostring(titlebarheight) +

+ 標題欄高度 + statusbarheight +

+ 檢視的寬度 + v.getwidth()

+ + 檢視的高度(不包含狀態列和標題欄) + v.getheight());

3樓:洛花留水

用actionbar比較好

android 狀態列和標題欄具體是**

4樓:匿名使用者

就我理解,標題欄是手機左上最頂上,顯示中國移動,安全衛士,或者當前執行軟體的地版

方,手機的頂部權。右邊顯示訊號,電量,網速等等是狀態列。

下拉就會出現通知欄。

至於導航欄是手機最下面的返回,home,主頁三個鍵,有些是一個按鈕。

機械製圖的標題欄怎麼做,推薦機械製圖示題欄格式

浪跡天涯的流星 1 要有工件或裝配圖名稱 數量 重量 材料。2 圖號 序號 編號 圖紙共幾張這是第幾張。3 圖紙修改空白處。 a4圖框我有,給你一份。一張完整的機械圖紙只要表達清楚實物就是好的。 首先學會畫法幾何 其次學會cad軟體。你就可以完成一張完整的機械圖了。 大謹三班 你學好機械製圖和cad...

如何新增自定義標題欄

您好!自定義標題欄,是不是您所說的黃鑽3級以上的自定義裝扮功能。首先您得是黃鑽使用者且3級以上,這樣才可以用這個功能。然後你製作自己喜歡的標題欄,標題欄寬度會895px,高度不限,按自己喜歡的製作,然後進入空間自定義,選擇自定義裝扮,新增標題欄,上傳你製作的 最後設定位置儲存就好了。我建議你的自定義...

2019退出單擊標題欄上的什麼圖示

真誠無怨無悔 這個問題很簡單。退出word2003在標題欄上有兩種方法。1,雙擊標題欄左上角的word文件圖示。如圖 2,單擊標題欄右上角的 就能關閉。如圖 退出方式常用有三種 1.標題欄右側的關閉按鈕 也就是那個x號 2.檔案選單中的退出選項 3.標題欄選單左側的控制選單按鈕 單擊或雙擊 其他方式...