Есть fragment
на котором есть два элемента отображены в xml
.
Первый (кастомный) привязан "наверху":
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
Второй (RecyclerView) привязан "внизу":
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
Но проблема в том, что если я задаю (как мне нужно) параметр высоты как wrap_content
он занимает все свободное пространство и отображается "сверху" (поверх первого элемента), если же задам высоту как константу - то отображается, как положено снизу.
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:background="@color/colorPrimary"
>
<com.luxary_team.openweather.ui.view.CurrentWeatherView
android:id="@+id/current_weather_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">
</com.luxary_team.openweather.ui.view.CurrentWeatherView>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view_general_fragment"
android:layout_width="match_parent"
android:layout_height="150dp"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true">
</android.support.v7.widget.RecyclerView>
</RelativeLayout>
Вопрос: что нужно добавить или изменить что бы при параметре android:layout_height="wrap_content"
горизонтальный RecyclerView
отображался внизу?
xml
элемента RecyclerView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/day_text_view_list_item_bottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:text="ПТ"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bottomUnactiveListItem"
android:gravity="center_horizontal"
android:orientation="vertical">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/icon_image_view_list_item_bottom"
android:layout_width="42dp"
android:layout_height="42dp"
android:background="@null"
app:srcCompat="@drawable/testicon"
tools:ignore="MissingPrefix"/>
<TextView
android:id="@+id/temperature_text_view_list_item_bottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="16 C"
android:textSize="16sp"
android:textStyle="bold"/>
</LinearLayout>
</LinearLayout>
android:layout_height="wrap_content"
только начиная с версии 23.4.0. Хотя это касалось вертикального режима, в горизонтальном не уверен чтоandroid:layout_height="wrap_content"
работает правильно.