Ich folge instructions here, um die actionBar
"float" über den Inhalt einer Aktivität, so dass mein Hintergrundbild erstreckt sich vom oberen Rand des Bildschirms statt unter der actionBar
. Allerdings muss ich jetzt meinen listView
an den unteren Rand der actionBar
ausrichten, da nun den listView
an der Oberkante ausrichtet.Android: Wie listet ListView am Ende der benutzerdefinierten ActionBar?
Gibt es eine Möglichkeit nur, dass in xml
zu erreichen? Was würde die id
der actionBar
sein, damit ich layout_below
setzen kann?
Ich bin sicher, dass ich die Höhe des actionBar
im Code erhalten/schätzen kann, um den oberen Rand des listView
dementsprechend einzustellen, aber ich hoffe auf eine elegantere Lösung. Dank
Der listView
Aktivität xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_users"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="@drawable/img_people_512"
android:id="@+id/usersImageView"
android:alpha="0.55"
android:contentDescription="@string/backgroundImage"
android:scaleType="centerCrop" />
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/userListView"
/>
</RelativeLayout>
des benutzerdefinierten actionBar
Layout xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mainActionBar"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="@+id/mainActionBarSpacer"
android:text="@string/mainActionBarSpacer"
android:textColor="@color/colourTransparent"
android:textSize="35sp"
android:fontFamily="cursive"
android:onClick="onClick" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toRightOf="@+id/mainActionBarSpacer"
android:layout_toEndOf="@+id/mainActionBarSpacer"
android:gravity="center"
android:id="@+id/mainActionBarTitle"
android:text="@string/app_name"
android:textColor="@color/colourActionBarText"
android:textSize="35sp"
android:fontFamily="cursive"
android:onClick="onClick" />
</RelativeLayout>
xml eingefügt thx – rockhammer