У меня есть Listview с пользовательским адаптером.Я получаю стандартную ошибку
Your content must have a ListView whose id attribute is 'android.R.id.list'
, однако в My ListView установлено значение android:id="@android:id/list"
.Это действительно заставляет меня задуматься. Есть предложения?
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/Layout">
<ListView android:id="@android:id/list" style="@stlye/ListMenuView"></ListView>
</LinearLayout>
styles.xml
<resources>
<style name="Layout" parent="@android:Theme">
<item name="android:background">@drawable/background</item>
<item name="android:scaleType">fitXY</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:orientation">vertical</item>
</style>
<style name="ListMenuView">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:cacheColorHint">#00000000</item>
</style>
</resources>
Мой метод onCreate:
/** Called when the activity is first created. */
@Override
public void onCreate( Bundle savedInstanceState ) {
super.onCreate( savedInstanceState );
setContentView( R.layout.main );
m_menu = new ArrayList<ListItemData>();
populateMenu();
this.m_adapter = new ListMenuAdapter( this, R.layout.list_item, m_menu );
setListAdapter(this.m_adapter);
}
Есть идеи?