ここで何が起こっているのかを理解するための支援を探しています。
リストの生成と表示に成功したカスタム リスト アダプター (BaseAdapter を拡張するだけ) があります。ここで、リストの最後に静的フッターを追加したいと考えています。いくつかのリソース (特にこれ)を調べた後、XML を使用することへの抵抗を終わらせる必要があることに気付き、devices_list.xml というファイルに次の xml レイアウトを設定しました。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout android:id="@+id/bottom_control_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<ToggleButton android:id="@+id/bottom_control_toggle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textOff="Filter Favourites OFF"
android:textOn="Filter Favourites ON"/>
</LinearLayout>
<ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_above="@id/bottom_control_bar">
</ListView>
<TextView android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/main_empty_list"
android:layout_above="@id/bottom_control_bar"/>
</RelativeLayout>
リストを保持するアクティビティを調整した後、コードを実行しました。フッター (およびすべての親であるタブ ウィジェット) が表示されますが、リストが表示される領域は空です。
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
this.setContentView(R.layout.devices_list);
db = new DbManager(this);
db.open();
AllCur = db.fetchAllDevices();
startManagingCursor(AllCur);
list = new DeviceListAdapter(this, AllCur); //make my custom list adapter
setListAdapter(list);
}
xml で宣言された ListView ウィジェットを DeviceListAdapter とリンクする方法はありますか? これがどのように機能しているのか完全にはわからないことは明らかです。明確化の助けをいただければ幸いです。