2

Hi there i have spent the good part of a day trying to figure this one out.

Problem So i have a recyclerview (NOT GRIDVIEW) implemented and it is showing 3 icons currently but they are at the top of the desired view. What i require is for the 3 icons to be centered and any x amount of icons that are used to be automatically centered both vertically sand horizontally.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Xview" >

<com.exmaple.app.topBar
    custom:gameState="paused"
    android:id="@id/score_bar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true" />

<com.exmaple.app.BottomBar
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:id="@+id/bottom_bar"
    />


<FrameLayout
   android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/score_bar"
android:layout_above="@+id/bottom_bar"
android:layout_centerInParent="true">


    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
android:background="#000000"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
    android:layout_gravity="top|center"
    android:scrollbars="none"


        />
</FrameLayout>

</RelativeLayout>

What i have tried: I have tried setting the recyclerview to layout:gravity="center"

auracool
  • 172
  • 8

0 Answers0