J'essaie de créer une ligne personnalisée pour mon RecyclerView
. Voici ma commande la mise en page de la ligne:Ligne personnalisée avec ImageView circulaire et textview en android
<?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="180dp"
android:layout_margin="5dp"
android:background="#00000000">
<FrameLayout
android:id="@+id/customLevelLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/levelImage"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_above="@+id/gameText"
android:layout_centerInParent="true"
android:scaleType="fitXY"
android:src="@drawable/circular_background" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="1"
android:textColor="#fff"
android:textSize="45sp" />
<TextView
android:id="@+id/gameText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:gravity="center"
android:textColor="#000"
tools:text="Tracing" />
</RelativeLayout>
<ProgressBar
android:id="@+id/gameProgressBar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:indeterminate="true"
android:padding="45dp"
android:visibility="gone" />
</FrameLayout>
<ImageView
android:id="@+id/lockImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/lock_background"
android:padding="45dp"
android:src="@drawable/lock"
android:visibility="gone" />
</RelativeLayout>
Voici comment il ressemble:
Le problème est, je dois définir une hauteur prédéfinie de la ligne personnalisée i.e. 170dp
actuellement. Je suis confronté à 2 problèmes à cause de cela:
1) Si j'ouvre l'application dans un petit écran ou une tablette. La rangée personnalisée est laide, je perds la forme circulaire de ImageView
.
2) Le texte ne reste pas au centre s'il y a un léger changement de disposition.
Ça a marché. Merci :) – XoXo
Bonne chance à vous. @ Hiren – KeLiuyue
Le 'ImageView' au bas de la mise en page qui, dans invisible prend une hauteur complète. Que faire ? @KeLiuyue – XoXo