當前位置:首頁 » 安卓系統 » android通知欄大小

android通知欄大小

發布時間: 2023-08-01 00:14:44

Ⅰ Android12正式發布,與之前相比做出了哪些改變

Android12正式發布,和之前的Android相比,整體設計更加圓滑,強調視覺色彩,觀感更加舒適。這次的更新,也是Android歷史上設計變化最大的一個版本。這次的推出雖然大多數用戶還沒有體驗上,但是整體來看大眾還是很接受這次的改變。

一:設計更加圓滑

這次的改變我們可以看出,從前的條條框框變得圓滑了,視覺效果的舒適度更加。以往大眾都是將Android系統和ios系統拿起來比較,在近年來iOS系統每年都會推出新的系統,受到大眾的追捧,谷歌這次更新Android12系統,很多人都是抱有期待的,在我看來,這次的更新還是不錯的,但是目前還在測試階段,大家還是謹慎更新,像iOS系統更新完之後會出現卡頓等問題,目前擔心的就是這一次Android12更新後也會出現類似的問題。

除了目前的一些更新,我覺得使用安卓機的用戶更想更新的是安卓系統用久了會卡頓的問題,所以希望在以後的更新中,谷歌公司會將這一項列入更新列表。

Ⅱ 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 app界面設計規范(dpi,dp,px等)

PPI(Pixels per inch):每英寸所擁有的像素數,即像素密度。
DPI(dots per inch):即每英寸上,所能印刷的網點數,一般稱為像素密度。ppi計算公式:ppi = 屏幕對角線像素數/屏幕對角線英寸數,通過勾股定理計算屏幕對角線像素數。
Screen Size(屏幕尺寸):手機屏幕尺寸大小,如3英寸、4英寸、4.3英寸、5.7英寸,指的是對角線的長度。
DIP(device independent pixel):即dip/dp,設備獨立像素。 1px = 1dp density(由dpi決定)
Resolution(解析度):指手機屏幕垂直和水平方向上的像素個數。eg解析度480
800,指該設備垂直方向有800個像素點,水平方向有480個像素點。
px(Pixel像素):相同像素的ui,在不同解析度的設備上效果不同。在小解析度設備上會放大導致失真,大解析度上被縮小。

Android Design里把主流設備的 dpi 歸成了四個檔次: 120 dpi、160 dpi、240 dpi、320 dpi ,具體見如下表格。
實際開發當中,我們經常需要對這幾個尺寸進行相互轉換(比如先在某個解析度下完成設計,然後縮放到其他尺寸微調後輸出),一般按照 dpi 之間的比例即 2:1.5:1:0.75 來給界面中的元素來進行尺寸定義。
也就是說如果以 160 dpi 作為基準的話,只要尺寸的 DP 是 4 的公倍數,XHDPI 下乘以 2,HDPI 下乘以 1.5,LDPI 下乘以 0.75 即可滿足所有尺寸下都是整數 pixel 。但假設以 240 dpi 作為標准,那需要 DP 是 3 的公倍數,XHDPI 下乘以 1.333,MDPI 下乘以 0.666 ,LDPI 下除以 2。而以 LDPI 和 XHDPI 為基準就更復雜了。同時第一款Android設備(HTC的T-Mobile G1)是屬於160dpi的。鑒於以上各種原因, 標准dpi=160

谷歌官方對dp的解釋如下:
A virtual pixel unit that you should use when defining UI layout, to express layout dimensions or position in a density-independent way.
The density-independent pixel is equivalent to one physical pixel on a 160 dpi screen, which is the baseline density assumed by the system for a "medium" density screen. At runtime, the system transparently handles any scaling of the dp units, as necessary, based on the actual density of the screen in use. The conversion of dp units to screen pixels is simple: px = dp * (dpi / 160). For example, on a 240 dpi screen, 1 dp equals 1.5 physical pixels. You should always use dp units when defining your application's UI, to ensure proper display of your UI on screens with different densities.

簡單來說,以160dpi的設備為准,該設備上1dp = 1px;如果屏幕密度大,1dip代表的px就多,比如在320dpi的屏幕上,1dip=2px(即1dp代表2個像素)。在app開發時,最好用dp來做界面的布局,以保證適配不同屏幕密度的手機。

dp和px的換算公式:

我的理解,該公式表示px的數值等於dp的數值*(設備dpi/160)
注意,px、dp是單位,但density沒單位。

applyDimension的源碼如下,可參考:

android的尺寸眾多,建議使用解析度為 720x1280 的尺寸設計。這個尺寸 720x1280中顯示完美,在 1080x1920 中看起來也比較清晰;切圖後的圖片文件大小也適中,應用的內存消耗也不會過高。

app啟動圖標為48*48dp,對應各dpi設備,圖像資源像素如下:

| mdpi | hdpi | xhdpi | xxhdpi |
| ---:| ---: | ---:| ---:| ---:|
|48 48px|72 72px|94 96px|144px 144px|

操作欄圖標為32*32dp,對應各dpi設備,圖像資源像素如下:其中圖形區域尺寸是24*24dp,可參考平時ui切圖會有部分留白。

| mdpi | hdpi | xhdpi | xxhdpi |
| ---:| ---: | ---:| ---:| ---:|
|32 32px|48 48px|64 64px|96px 96px|

通知欄圖標為24*24dp,對應各dpi設備,圖標像素如下:

| mdpi | hdpi | xhdpi | xxhdpi |
| ---:| ---: | ---:| ---:| ---:|
|24 24px|36 36px|48 48px|72px 72px|

某些場景需要用到小圖標,大小應當是16*16dp,其中圖形區域尺寸12*12dp。

| mdpi | hdpi | xhdpi | xxhdpi |
| ---:| ---: | ---:| ---:| ---:|
|16 16px|24 24px|32 32px|48px 48px|

Ⅳ android 自定義通知欄

Notification 參數使用 參考:
http://www.cnblogs.com/kexing/p/8371051.html

自定義通知欄
僅支持FrameLayout、LinearLayout、RelativeLayout三種布局控制項
AnalogClock、Chronometer、Button、ImageButton、ImageView、ProgressBar、TextView、ViewFlipper、ListView、GridView、StackView和AdapterViewFlipper這些顯示控制項
否則會引起ClassNotFoundException異常。

流程:點擊通知欄 發送廣播 app接收廣播做相應處理:

為通知欄綁定廣播事件:

1.FLAG_CANCEL_CURRENT:如果AlarmManager管理的PendingIntent已經存在,那麼將會取消當前的PendingIntent,從而創建一個新的PendingIntent.
2.FLAG_UPDATE_CURRENT:如果AlarmManager管理的PendingIntent已經存在,讓新的Intent更新之前Intent對象數據,例如更新Intent中的Extras,另外,我們也可以在PendingIntent的原進程中調用PendingIntent的cancel ()把其從系統中移除掉
3.FLAG_NO_CREATE:如果AlarmManager管理的PendingIntent已經存在,那麼將不進行任何操作,直接返回已經.
4.FLAG_ONE_SHOT:該PendingIntent只作用一次.在該PendingIntent對象通過send()方法觸發過後,PendingIntent將自動調用cancel()進行銷毀,那麼如果你再調用send()方法的話,系統將會返回一個SendIntentException.

添加廣播接收:

AndroidManifest:

Ⅳ android 5.0 橫屏狀態下下拉通知欄

布局文件所在/frameworks/base/packages/SystemUI/res/layout
status_bar_expanded_header.xml為下拉菜單中頭部的布局文件,包括時間、日期、設置等。

status_bar_expanded.xml 為下拉菜單整體布局

com.Android.systemui.statusbar StatusBarIconView修改下拉菜單中icon布局

public StatusBarIconView(Context context, String slot, Notification notification) {
super(context);
final Resources res = context.getResources();
mSlot = slot;
mNumberPain = new Paint();
mNumberPain.setTextAlign(Paint.Align.CENTER);
mNumberPain.setColor(res.getColor(R.drawable.notification_number_text_color));
mNumberPain.setAntiAlias(true);
mNotification = notification;
setContentDescription(notification);

// We do not resize and scale system icons (on the right), only notification icons (on the
// left).
if (notification != null) {
final int outerBounds = res.getDimensionPixelSize(R.dimen.status_bar_icon_size);
final int imageBounds = res.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size);
final float scale = (float)imageBounds / (float)outerBounds;
setScaleX(scale);
setScaleY(scale);
final float alpha = res.getFraction(R.dimen.status_bar_icon_drawing_alpha, 1, 1);
setAlpha(alpha);
}

setScaleType(ImageView.ScaleType.CENTER_INSIDE);
}

Ⅵ Android通知欄詳解

可以看到,Android通知欄默認是標題顯示一行,內容顯示一行,對於一行顯示不完的,用省略號代替。

這是常見的通知欄的樣式,不再贅述。
在不同的手機上,只設置builder.setSmallIcon(R.drawable.ic_launcher)表現可能不一致,在華為P9上不會顯示大的icon,只會顯示小的icon。但是在魅族上卻顯示了,顯示的應該是應用的默認圖標。

所以建議還是設置

與上面的顯示多行文本類似,也是在Android4.1中官方推出的Notification.BigPictureStyle。
使用方式也相同

是因為在用戶還沒有劃出通知欄的時候需要提醒用戶收到通知,所以需要顯示smallIcon。

熱點內容
jsp訪問不到資料庫資料庫資料庫 發布:2025-02-04 16:41:24 瀏覽:283
歐迪a4哪個配置最值得買 發布:2025-02-04 16:39:08 瀏覽:303
編譯包含調試信息的oat文件 發布:2025-02-04 16:39:07 瀏覽:152
一夢江湖官服怎麼在安卓下載 發布:2025-02-04 16:38:17 瀏覽:857
電腦華為雲空間哪裡密碼設置 發布:2025-02-04 16:22:15 瀏覽:756
sql不重復記錄 發布:2025-02-04 16:21:39 瀏覽:511
硬碟緩存速度 發布:2025-02-04 16:20:51 瀏覽:586
cmc的密碼是什麼意思 發布:2025-02-04 16:16:01 瀏覽:970
ccs編譯找不到匯編程序 發布:2025-02-04 16:15:52 瀏覽:772
安卓如何恢復刪除記錄 發布:2025-02-04 16:12:08 瀏覽:609