Я пытаюсь получить три ряда в моем recyclerview, чтобы идеально подогнать экран. Другими словами, распределяется равномерно без прокрутки. У меня есть панель инструментов и recyclerview с двумя столбцами/тремя строками. На данный момент я только что установил высоту элементов, чтобы подогнать экран достаточно близко, но должен быть лучший способ?Распределите сетки равномерно, чтобы соответствовать экрану
activity_main.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=".MainActivity">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_below="@id/toolbar"
android:background="#CCCC"
android:layout_width= "match_parent"
android:layout_height = "match_parent"/>
</RelativeLayout>
item.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">
<View
android:id="@+id/colorBlock"
android:layout_width="match_parent"
android:layout_height="170dp"
android:background="#CCCCCC" />
<ImageView
android:id="@+id/item"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_centerHorizontal="true"
android:padding="16dp"
/>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:textColor="@android:color/white"
android:textSize="16sp"/>
</RelativeLayout>
Оцените ответ. Я попробую это, так как я до сих пор не нашел никакого решения, использующего recyclerview (не похоже на способ его решения). Благодаря! – Stansley