私は、ListViewとImageで構成されるレイアウトを持っています。
私はリストビュー(左上隅)の上にイメージを配置したいですが、アプリケーションを実行すると、リストビューのみが表示され、イメージはリストビューの後ろになります。 リストの最初の項目の代わりに画像を表示したい。
提案がありますか?ImageViewがListViewの上に表示されます
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@android:color/background_light"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="100">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/back"
android:id="@+id/back_button"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_gravity="left"
android:focusable="true"
/>
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:choiceMode="multipleChoice">
</ListView>
</FrameLayout>
</RelativeLayout>
</LinearLayout>
Googleの「アンドロイドリストビューヘッダー」には、何百もの有用な結果が見つかります。このように:https://www.android-examples.com/add-set-header-to-listview-in-android-programmatically/ –