2013-03-22 77 views
5

我有一個簡單的DialogFragment,它顯示了一些文本(包含一個Year字符串),然後是一個SeekBar,用戶可以滑動並更改Year字符串。在DialogFragment上設計文本

在Android 3和4上,這看起來是正確的......這些平臺有淺色背景並使用黑色文本。

enter image description here

但是,在Android上2,對話框中有一個黑暗的背景,並依然採用黑色文本。

enter image description here

我不希望有配置不同的Android版本不同的配色方案,因爲一定是建立在Android系統一些默認值,我應該能夠使用我的風格TextView,以便它使用適當的文本顏色。

這裏是我的TextView顯示的年份字符串:

<TextView 
    android:id="@+id/textViewYear" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 
    android:layout_centerHorizontal="true" 
    android:layout_marginTop="10dp" 
    android:text="1976" 
    android:textAppearance="?android:attr/textAppearanceLarge" /> 

我可以申請我的TextView什麼設置,以便它總是會通過適當的制度有色?

請注意,我不能只使用逆風格,因爲在Android 3和4上它工作正常。如果我使用逆文本外觀,然後它工作在Android 2,但未能對3和4

回答

2

我發現solution on another SO post

builder.setInverseBackgroundForced(true) 

在Android 3.x和4.x,這並不似乎改變了任何事情,但在Android 2.x上,它將顏色方案顛倒過來,以便背景爲白色,以便黑色文本正確顯示。

+0

它的工作,但標題仍然黑暗... – 2013-05-25 23:12:43