メイン クラスが ListActivity を拡張するアプリがあります。
public class GUIPrototype extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Cursor c = managedQuery(People.CONTENT_URI, null, null, null, null);
String[] from = new String[] {People.NAME};
int[] to = new int[] { R.id.row_entry };
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,R.layout.drawer,c,from,to);
setListAdapter(adapter);
getListView().setTextFilterEnabled(true);
}
}
XML にスライディング ドロワーが含まれており、別のリストビューをスライディング ドロワーに表示しようとしています。インフレータを使用して 2 番目のリストビューを作成しようとしています。
View inflatedView = View.inflate(this, R.layout.main, null);
ListView namesLV = (ListView) inflatedView.findViewById(R.id.content);
String[] names2 = new String[] { "CS 345", "New Tag", "Untagged" };
ArrayAdapter<String> bb = new ArrayAdapter<String>(this, R.layout.main, R.id.row_entry, names2);
namesLV.setAdapter(bb);
これはコンパイルおよび実行されますが、slidedrawer は完全に空白です。私のXMLは次のとおりです。
<SlidingDrawer
android:id="@+id/drawer"
android:handle="@+id/handle"
android:content="@+id/content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="bottom">
<ImageView
android:id="@id/handle"
android:layout_width="48px"
android:layout_height="48px" android:background="@drawable/icon"/>
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@id/content"/>
</SlidingDrawer>
重要な一歩を踏み外したような気がします。グーグルで問題に関するリソースを見つけられなかったので、助けていただければ幸いです。
編集:これはずっと前の問題であり、私が見つけた解決策はレイアウトを再設計することでした. それらをテストする手段がないため、回答を受け入れることができません。