0

我正在尝试在我的应用程序中更改首选项屏幕的背景。我可以通过这样做添加图像:

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.applicationsettings);

        findViewById(android.R.id.list).setBackgroundDrawable(getResources().getDrawable(R.drawable.app_bg));
    }

背景出现了,但是当我滚动时,它在普通列表中显示黑色缓存,我设置了缓存提示,,,但是在这里我不能这样做!有办法解决吗?

我试过:“findViewById(android.R.id.list).setDrawingCacheBackgroundColor(Color.TRANSPARENT);” 但它没有用。

更新 解决方案是:

ListView listView = (ListView)findViewById(android.R.id.list);
listView.setBackgroundDrawable(getResources().getDrawable(R.drawable.app_bg));
listView.setCacheColorHint(Color.TRANSPARENT);

感谢:user370305

4

1 回答 1

1

试试这个,

ListView listView = (ListView)findViewById(android.R.id.list);
listView.setBackgroundDrawable(getResources().getDrawable(R.drawable.app_bg));
listView.setCacheColorHint(Color.TRANSPARENT);

让我知道发生了什么..

于 2012-05-05T06:00:21.430 回答