本文介绍了setCacheColorHint上listfragments的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Android的兼容性,而且我在使用非坚实的背景的一些问题listfragments。问题是在这个环节相同的描述但调用setCacheColorHint上this.listView()不有任何影响。没有任何人有什么回事好吗?

I am using android compatibility library, and I am having some problems with listfragments using a non solid background. The issue is the same described on this link but calling setCacheColorHint on this.listView() does not have any effects. Does anybody have some idea about what's going on?

<fragment class="com.mypackage.MyFragment"
android:id="@+id/my_fragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

和片段类,这恰好是一个ListFragment里面,我有

and inside the fragment class, which happens to be a ListFragment, I have

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {

    getListView().setCacheColorHint(android.R.color.transparent);
    super.onViewCreated(view, savedInstanceState);
}

谢谢

推荐答案

您需要添加 getListView()。setCacheColorHint(Color.TRANSPARENT) onActivityCreated 方法,而不是 onViewCreated

You need to add getListView().setCacheColorHint(Color.TRANSPARENT) in onActivityCreated method instead onViewCreated

这篇关于setCacheColorHint上listfragments的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!