2011-12-26 33 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

相关问题