① android app 界面設計按什麼尺寸
android app 界面設計是按720*1280的,切圖上可以點9切圖做到所有手機的適配。
狀態欄、導航欄和主菜單欄,以720*1280的尺寸來設計,那麼狀態欄的高度應為50px,導航欄的高度96px,主菜單欄的高度96px,因為是開源的系統,這里的數值也只能作為參考。
Android為了區別於IOS,從4.0開始提出了一套HOLO的UI風格設計風格,鼓勵將底部的主菜單欄放到導航欄下面,從而避免點擊下方材料誤點虛擬按鍵,很多APP的新版中也採用了這一風格。
(1)android狀態欄大小擴展閱讀:
注意事項:
1、通常情況要定位一個Icon只需給出 上/下邊距,左/右邊距,標注圖標距離只需標到可點擊范圍外
通用型顏色、字體單獨標明一份,通用型模塊只需單獨標明一份,如導航欄。
2、手機可視區域通常為寬度固定,長度超出邊界可滑動,所以標注物體寬度時可按比例說明,如果要標注內容上下居中,左右居中,或等比可不標注。
3、當交付的是一張完整圖片時,不需做機型適配,只需給高清圖(1920*1080)即可,注意進行壓縮。
4、若圖標在不同頁面重復出現,且尺寸相差不大,直接給出最大一份切圖,並在圓形圖標明尺寸,程序會根據需求縮放。
5、當背景是純色時只需給出色值,Android使用16進制色值。
參考資料來源:網路-Android
參考資料來源:網路-界面設計
參考資料來源:網路-狀態欄
參考資料來源:網路-導航欄
參考資料來源:網路-開源系統
參考資料來源:網路-切圖
參考資料來源:網路-UI設計
② 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());}效果:
③ 如何修改 Android 狀態欄高度
修改 Android 狀態欄高度:
配置文件:frameworks/base/core/res/res/values/dimens.xml
修改條目:
<resources>
<!-- The width that is used when creating thumbnails of applications. -->
<dimen name="thumbnail_width">0dp</dimen>
<!-- The height that is used when creating thumbnails of applications. -->
<dimen name="thumbnail_height">0dp</dimen>
<!-- The standard size (both width and height) of an application icon that
will be displayed in the app launcher and elsewhere. -->
<dimen name="app_icon_size">48dip</dimen>
<dimen name="toast_y_offset">64dip</dimen>
<!-- Height of the status bar -->
<dimen name="status_bar_height">38dip</dimen>
<!-- Height of the status bar -->
<dimen name="status_bar_icon_size">38dip</dimen>
<!-- Margin at the edge of the screen to ignore touch events for in the windowshade. -->
<dimen name="status_bar_edge_ignore">5dp</dimen>
<!-- Size of the fastscroll hint letter -->
<dimen name="fastscroll_overlay_size">104dp</dimen>
<!-- Width of the fastscroll thumb -->
<dimen name="fastscroll_thumb_width">64dp</dimen>
<!-- Height of the fastscroll thumb -->
<dimen name="fastscroll_thumb_height">52dp</dimen>
<!-- Default height of a key in the password keyboard -->
<dimen name="password_keyboard_key_height">56dip</dimen>
<!-- Default correction for the space key in the password keyboard -->
<dimen name="password_keyboard_spacebar_vertical_correction">4dip</dimen>
</resources>
④ 關於 Android 中的各種 Bar 和「透明狀態欄」的一些知識
關於Android中的各種Bar和「透明狀態欄」的知識如下:
一、狀態欄 定義:狀態欄是Android設備頂部顯示時間、通知等信息的區域。 顏色調整:從Android 4.4開始,引入了windowTranslucentStatus特性,使狀態欄顏色可調。
二、ActionBar 引入版本:Android 3.0引入,用於替代早期的TitleBar。 功能:ActionBar不僅顯示頁面標題,還擴展了更多功能,如導航、菜單項等。 形式:ActionBar不是傳統的控制項形式,而是嵌套在DecorView中,可通過window.setFeatureInt方法進行功能和樣式的修改。
三、ToolBar 引入版本:Android 5.0引入。 特點:ToolBar是一個獨立控制項,為開發者提供了更多的靈活性。 使用范圍:ToolBar可以在Android 5.0及以上的版本中使用。
四、透明狀態欄 實質:透明狀態欄實際上是狀態欄透明模式,即內容UI全屏,狀態欄透明。 實現方式: 1. 設置內容布局全屏,使內容覆蓋頂部狀態欄。 2. 將狀態欄設為透明。 3. 應用屬性以確保布局全屏顯示。 注意事項:狀態欄顏色的修改在Android 5.0後支持,在Android 4.4之前則不允許。
五、全屏模式 定義:全屏模式是指應用界面占據整個屏幕,不顯示狀態欄或其他系統UI元素。 實現:為了實現全屏模式,開發者應考慮使用頁面布局,並通過DecorView來獲取根布局,進而控制狀態欄顯示與布局的全屏擴展。
六、總結 Android中的各種Bar和狀態欄在設計和功能上有所不同,但它們共同構成了Android應用的界面框架。 透明狀態欄是一種特殊的狀態欄模式,它使應用內容能夠全屏顯示,增強了用戶體驗。 開發者應根據應用需求和目標用戶群體的設備版本,選擇合適的Bar和狀態欄配置。