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