標籤:中文 菜單 抽屜 底部導覽列 win regular density touch 使用
wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics dm = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(dm); //將當前視窗的一些資訊放在DisplayMetrics類中
float density = dm.density; //密度 px = dp * density dp/px = density
int dpi = dm.densityDpi;
width = dm.widthPixels;
height = dm.heightPixels;
px = dp * density dp/px = density
焦點: android:focusable=“true” 不會改變android:focusableInTouchMode鍵盤
android:focusable=“false”,一定會使android:focusableInTouchMode=“false”
android:focusableInTouchMode=“false”,不會影響android:focusable針對觸屏
android:focusableInTouchMode=”true”,一定會是android:focusable=“true”
字型
英文字型使用Roboto,中文字型使用Noto。Noto有7種字重:Thin, Light、DemiLight、Regular、Medium、Bold 和 Black。
文字排版
常用字型大小:
12sp 小字提示
14sp(案頭端13sp) 本文/按鈕文字
16sp(案頭端15sp) 小標題
20sp Appbar文字
24sp 大標題
34sp/45sp/56sp/112sp 超大號文字
長篇幅本文,每行建議60字元(英文)左右。短文本,建議每行30字元(英文)左右。
布局
所有可操作元素最小點擊地區尺寸:48dp X 48dp。
柵格系統的最小單位是8dp,一切距離、尺寸都應該是8dp的整數倍。以下是一些常見的尺寸與距離:
頂部狀態列高度:24dp
Appbar最小高度:56dp
底部導覽列高度:48dp
懸浮按鈕尺寸:56x56dp/40x40dp
帳戶圖片尺寸:64x64dp/40x40dp
小表徵圖點擊地區:48x48dp
側邊抽屜到螢幕右邊的距離:56dp
卡片間距:8dp
分隔線上下留白:8dp
大多元素的留白距離:16dp
螢幕左靠右對齊基準:16dp
文字左側對齊基準:72dp
tab只用來展現不同類型的內容,不能當導覽功能表使用。tab至少2項,至多6項。
tab選中項的底線高度是2dp
android 介面設計