0

Is it possible to set a RecyclerView that has width = "match parent" (entire screen). If there are fewer children in the view, distribute them evenly instead of pushing them to the left. Here is the screenshot: I don't want the hourly weather icon in the middle to be pushed to the left. Thanks.

enter image description here

Edit: adding layout files:

<android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerview_hourly"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clipToPadding="false"
    android:paddingBottom="8dp"/>

child layout:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <TextView
        android:id="@+id/hourly_time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="@style/TextAppearance.AppCompat.Body1"
        android:text="Now"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toTopOf="@+id/hourly_icon" />

    <ImageView
        android:id="@+id/hourly_icon"
        android:layout_width="@dimen/list_icon"
        android:layout_height="@dimen/list_icon"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/hourly_time"
        app:layout_constraintBottom_toTopOf="@+id/hourly_temp" />



    <TextView
        android:id="@+id/hourly_temp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="@style/TextAppearance.AppCompat.Body1"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:text="45"
        app:layout_constraintTop_toBottomOf="@+id/hourly_icon"
        app:layout_constraintBottom_toBottomOf="parent" />

</android.support.constraint.ConstraintLayout>
ericcire
  • 313
  • 1
  • 6
  • 12

0 Answers0