Как расположить два layout ниже RecyclerView
Всех приветствую. Подскажите пожалуйста,как расположить layouts ниже RecyclerView. В моём интерфейсе они не отображаются (frameLayout нужен для добавления фрагмента в код). Мне советовали constraintLayout,но может можно как-то обойтись без него? Заранее благодарю всех за помощь.
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:contentDescription="@string/title_favourites">
<TextView
android:id="@+id/empty_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="24sp"
android:layout_margin="@dimen/text_margin"
android:minHeight="48dp"
android:clickable="true"
android:text="@string/favourites_info"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list"
android:name=".FragmentFavouriteNews"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
tools:context=".FragmentNews"
tools:listitem="@layout/fragment_item_news">
</androidx.recyclerview.widget.RecyclerView>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/list"
android:id="@+id/pagecontainer"
android:layout_alignParentBottom="true"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/layout"
android:layout_below="@id/pagecontainer"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/save"
android:text="@string/save_favourites"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/load"
android:text="@string/load_favourites"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/clear"
android:text="@string/clear_favourites"/>
</LinearLayout>
</RelativeLayout>
Ответы (1 шт):
Автор решения: alexandr kozlovskiy
→ Ссылка
Слава Богу благодаря @Style-7 и @Hellraiser у меня всё получилось. Вот мой 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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:contentDescription="@string/title_favourites">
<TextView
android:id="@+id/empty_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="24sp"
android:layout_margin="@dimen/text_margin"
android:minHeight="48dp"
android:clickable="true"
android:text="@string/favourites_info"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list"
android:name=".FragmentFavouriteNews"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
tools:context=".FragmentNews"
android:layout_above="@id/pagecontainer"
tools:listitem="@layout/fragment_item_news">
</androidx.recyclerview.widget.RecyclerView>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/pagecontainer"
android:layout_alignParentBottom="true"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/layout"
android:layout_below="@id/list"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/save"
android:text="@string/save_favourites"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/load"
android:text="@string/load_favourites"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/clear"
android:text="@string/clear_favourites"/>
</LinearLayout>
</RelativeLayout>
Благослови всех вас Бог за помощь. Теперь,вроде,всё работает как надо.