Centrer un RecyclerView au sein d'un RelativeLayout
Bonjour,
Cela fait quelques temps que je tente de centrer sans succès un Recycler affichant une liste d'ImageView/TextView au sein d'un RelativeLayout.
J'ai tenté un gravity="center" ainsi qu'un layout_gravity="center" mais rien n'y fait.
Voici mon RecyclerView :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/fragment_atelier_recycler_view_2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:scrollbarStyle="insideOverlay"
android:paddingTop="10dp"
android:overScrollMode="never"
android:layout_centerHorizontal="true"
android:background="@color/red">
</android.support.v7.widget.RecyclerView>
</RelativeLayout> |
Ainsi que mon mon row layout :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:gravity="center_horizontal" android:weightSum="10"
android:paddingRight="15dp">
<ImageView
android:id="@+id/item_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:layout_alignParentLeft="true"
android:adjustViewBounds="true"
android:scaleType="centerInside"
android:layout_weight="9"/>
<com.ylly.hypred.custom.MyTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/item_layout_nom_atelier_textView"
android:textColor="@color/dark_red"
custom:font_name="Arial-Bold.ttf"
android:layout_below="@id/item_icon"
android:layout_weight="1"/>
</LinearLayout> |
Merci d'avance pour vos réponses ;)