ListActivity のリスト ビューの上にタイトル バーを追加したいと考えています。リスト ビューがスクロールされたときにタイトル バーがスクロールして離れないようにする必要があるため、addHeaderView() を使用していませんが、XML で定義されたカスタム ビューを使用しています。次のようになります。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp">
<LinearLayout
android:id="@+id/top_control_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView android:id="@+id/left_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Some text" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:src="@drawable/ic_launcher" />
</RelativeLayout>
</LinearLayout>
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_below="@id/top_control_bar"
android:drawSelectorOnTop="false" />
</RelativeLayout>
ご覧のとおり、タイトル バーにはテキスト ビューとイメージ ビューが含まれています。私の質問は次のとおりです。このタイトル バーは、リスト ビューの単一の行とまったく同じサイズ (タイトル バーの高さとフォント サイズ) を使用したいと思います。サイズ情報をハードコーディングしたくありません。代わりに、タイトル バーは常にリストビューの 1 行と同じ大きさにする必要があり、Android は、タイトル バーの画像ビュー用に適切なサイズの「ic_launcher」ドローアブルを選択する必要があります。 *.apk ですが、これは自動的に行われると思います。タイトル バーが常にリスト ビューの 1 行と同じ大きさになるように指示する方法を見つける必要があるだけで、タイトル バーのテキスト ビューのフォント サイズもリスト ビューの行のフォント サイズと一致する必要があります。
どうすればこれを達成できるか教えてもらえますか?どうもありがとう!