フラグメント内にリストビューを実装するのに問題があります。
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" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/jo_logo" />
</LinearLayout>
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
</ListView>
</LinearLayout>
単純なImageViewとその後のリストビュー。私はすでに実装しようとしました:
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity().getBaseContext(),
android.R.layout.simple_list_item_1, viewList);
setListAdapter(adapter);
ここで、viewListはonCreateView関数のView[]です。フラグメント内ではそのように機能していないようです。最初のビューがImageViewで、2番目のビューがListViewであり、すべてフラグメント内にある必要があります。
助けてください、事前に感謝します、udi