2011-12-26 38 views
2

我的問題是,我得到白色背景上的白色文本,如下圖所示。當我點擊它的文本得到黑色在使用Theme.Light的ListFragment中的白色背景上的白色文本

enter image description here

這是我的佈局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 

<LinearLayout 
    android:id="@id/actionbar" 
    style="@style/SPActionBar" /> 

<fragment 
    android:id="@+id/layout_home_list_fragment" 
    android:name="at.bartinger.smartphonelib.activity.fragment.ProfileListFragment" 
    android:layout_width="fill_parent" 
    android:layout_height="0dp" 
    android:layout_weight="1" /> 

<LinearLayout 
    android:id="@+id/layout_home_adlayout" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 
</LinearLayout> 

ProfileListFragment延伸ListFragment和我說,整個應用程序使用Theme.Light(在清單xml)

+0

將文本顏色更改爲黑色。 – AAnkit 2011-12-26 15:46:53

+0

默認情況下它應該爲黑色 – 2011-12-26 15:59:47

+0

它在黑色背景上爲白色。因爲你把背景變成了白色。你應該改變文字顏色爲黑色 – AAnkit 2011-12-26 17:23:59

回答

3

你在SimpleCursorAdapter中使用了這個:

getActivity().getApplicationContext() 

如果是的話,請用

getActivity().getBaseContext() 

它應該做的伎倆。

+1

處理在閱讀有關getBaseContext(),它聽起來像應該避免。我能夠通過使用getView()。getContext()來解決此問題。 – 2013-11-07 21:45:42

相關問題