これは私のxmlファイルです:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background"
android:orientation="vertical"
android:padding="15dip" >
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
私のコードでは、ウィンドウの背景色を変更したいと思います。次のようにしています。
ListView listview = (ListView) findViewById(android.R.id.list);
View root = listview.getRootView();
root.setBackgroundColor(Color.parseColor("#bdbdbd"));
これを正しく理解していれば、リストビューの親 (この場合は LinearLayout) の背景色が変更されるはずです。しかし、これは機能していません。何が間違っていますか?