簡體   English   中英

如何獲取Android通知的高度?

[英]How to get the height of android notification?

我必須為我的應用程序使用自定義通知布局。 該通知適合默認空間,因此不想使用bigContentView 但是要正確地重新分配布局組件,我想知道電話創建的默認通知的高度。 在我的MarshMellow手機中看起來大約為50dp。

注意:我也想知道棒棒糖手機之前的情況

它是16 + 16 + 8 + 14 + 16 = 70dp。 請參閱設計准則dimens.xml

<!-- Size of notification text (see TextAppearance.StatusBar.EventContent) -->
<dimen name="notification_text_size">14sp</dimen>
<!-- Size of notification text titles (see TextAppearance.StatusBar.EventContent.Title) -->
<dimen name="notification_title_text_size">16sp</dimen>
<!-- Size of smaller notification text (see TextAppearance.StatusBar.EventContent.Line2, Info, Time) -->
<dimen name="notification_subtext_size">12sp</dimen>

預棒棒糖(或至少奇巧)的調料可以在這里找到。

基於這些值

<!-- Size of notification text (see TextAppearance.StatusBar.EventContent) -->
<dimen name="notification_text_size">14dp</dimen>
<!-- Size of notification text titles (see TextAppearance.StatusBar.EventContent.Title) -->
<dimen name="notification_title_text_size">18dp</dimen>
<!-- Size of smaller notification text (see TextAppearance.StatusBar.EventContent.Line2, Info, Time) -->
<dimen name="notification_subtext_size">12dp</dimen>

它們的高度應為16 + 18 + 8 + 14 + 16 = 72dp。 我找不到用於填充的預先棒棒糖規格,因此我使用了材料規格。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM