У меня есть RelativeLayout
с параметром высоты match_parent
, а в этом у меня есть еще LinearLayout
со свойством layout_alignParentBottom=true
.
Я использую этот макет для отображения MediaController
кнопок.
Ниже то, что я ожидаю получить в MediaController
Но ниже то, что я получаю на Lollipop 5.1
(я только что добавил жестко закодированное нижнее поле в макет, что вовсе не является решением, поскольку оно не будет хорошо работать на всех устройствах).
Макет скрывается за нижней задней панелью кнопок.
Каким будет лучший способ обеспечить только необходимое поле снизу в соответствии с высотой нижней панели, поскольку этот макет отлично работает в других версиях Android и более ранних телефонах Android с аппаратными кнопками возврата.
Мой файл XML выглядит так
<RelativeLayout 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"
tools:context="com.mypack.MyActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottomLinear"
android:orientation="vertical" >
<ImageView
android:id="@+id/albumArt"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_gravity="center"
android:background="@drawable/default_cover" />
<TextView
android:id="@+id/titleOfSong"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="3"
android:text="Title Of Song"
android:textSize="18sp" />
<TextView
android:id="@+id/albumOfSong"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="3"
android:text="Album Of Song"
android:textSize="16sp" />
<TextView
android:id="@+id/artistOfSong"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="3"
android:text="Artist Of Song"
android:textSize="18sp" />
<TextView
android:id="@+id/genreOfSong"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="3"
android:text="Genre Of Song"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/bottomLinear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
</LinearLayout>
</RelativeLayout>
Тема приложения
<style name="AppBaseTheme" parent="Theme.AppCompat"></style>
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:windowDisablePreview">true</item>
<item name="android:windowAnimationStyle">@null</item>
</style>