我的應用程序使用白色字體,這是我的手機上有一個黑色的主題是好的。 但在其他手機上,通知欄顏色和菜單背景顏色爲白色或淺色。有沒有什麼辦法(除了讓用戶選擇在應用程序設置中選擇顏色的選項)知道什麼樣的顏色或暗/主題使用手機並匹配字體顏色?如何使文本顏色與通知顏色條匹配?
3
A
回答
4
當您使用的通知,並通過內置的方式設置文本,以下行創建佈局:
RemoteViews contentView = new RemoteViews(context.getPackageName(),
com.android.internal.R.layout.status_bar_latest_event_content);
所提到的佈局包含以下視圖負責查看通知文本:
<TextView android:id="@+id/text"
android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:paddingLeft="4dp"
/>
所以得出的結論是,需要的風格是TextAppearance.StatusBar.EventContent,它的定義是這樣的:
<style name="TextAppearance.StatusBar.EventContent">
<item name="android:textColor">#ff6b6b6b</item>
</style>
您應該在此注意,此樣式實際上並未引用任何內置顏色,因此最安全的方法是應用此樣式而不是某種內置顏色。
0
我使用Android:textAppearance = 「@風格/ TextAppearance.AppCompat.Notification.Title」 工作讓我
相關問題
- 1. CSS:線條通過與文本顏色不同的顏色?
- 2. 將箭頭顏色與D3中的線條顏色相匹配
- 3. 如何匹配RGB顏色與RGBA顏色
- 4. řmatplot匹配圖例顏色線條顏色
- 5. 如何設置純色圖像以匹配文本顏色?
- 6. 通知LED - 顏色
- 7. 顏色與線條
- 8. 如何使用漸變顏色爲配色圖上的顏色條?
- 9. 更改與父文本顏色不同的子文本顏色?
- 10. iOS - 匹配界面顏色
- 11. Colorscale不匹配顏色(python)
- 12. 匹配ApplicationIcon.jpg重音顏色
- 13. dc.js顏色餅圖顏色與顏色域的顏色
- 14. 如何獲得匹配顏色#f20044
- 15. 匹配windows系統顏色:淺色
- 16. matplotlib:匹配傳奇色彩patchCollection顏色
- 17. matplotlib:更改標題和顏色條文本和刻度顏色
- 18. 使樹狀圖中的刻度線顏色與簇顏色匹配
- 19. Android:如何在View.onDraw()中使用RGB_565顏色來匹配位圖顏色
- 20. WatchKit通知標題顏色
- 21. Android顏色通知圖標
- 22. Pnotify通知顏色不對
- 23. 文本顏色與微調器不匹配
- 24. ggplot2:更改置信區域的顏色以匹配線條的顏色
- 25. UINavigation條顏色
- 26. 在顏色範圍內尋找最接近的顏色匹配
- 27. 設置圖像顏色以匹配背景顏色php
- 28. 更改面板的顏色以匹配用戶主題顏色
- 29. Excel VBA,匹配字體顏色和單元格背景顏色
- 30. 使用rgl顏色不匹配
看一看[此帖](http://stackoverflow.com/questions/4867338/custom -notification的佈局和文本 - 顏色)。它會幫助你瞭解你能做什麼,不能做什麼。 – Andrei