0

The attached is my code for the Relative Layout based Image display, The Profile name along with the username - displays the username, Email id - displays the email id, Change password and Signout. But the Field values are overlapping in the username and Email. Can any one suggest a better idea that the values do not overlap.

Please find the code as below:

<android.support.percent.PercentRelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.LinearLayoutCompat
        android:id="@+id/profile"
        android:background="@color/grey_100"
        app:layout_aspectRatio="300%"
        app:layout_widthPercent="100%">
        <LinearLayout
            android:layout_width="match_parent"
            android:orientation="vertical"
            android:layout_height="wrap_content">

            <ImageView
                android:id="@+id/img_avatar"
                android:layout_gravity="center"
                android:layout_width="75dp"
                android:layout_height="75dp"
                android:layout_marginTop="5dp"
                android:src="@drawable/default_avata"
                android:background="#00000000"/>
            <TextView
                android:layout_gravity="center"
                android:textSize="20sp"
                android:textColor="@android:color/black"
                android:layout_marginTop="15dp"
                android:id="@+id/tv_username"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"/>
        </LinearLayout>
    </android.support.v7.widget.LinearLayoutCompat>

    <android.support.v7.widget.RecyclerView
        android:layout_below="@+id/profile"
        android:id="@+id/info_recycler_view"
        android:layout_marginTop="15dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</android.support.percent.PercentRelativeLayout>

Please find the screenshot attached:

enter image description here

Onik
  • 19,396
  • 14
  • 68
  • 91
  • use linear layout with weight, instead of relative layout. – RBK Nov 14 '17 at 11:37
  • send your row_view code which is used in RecyclerView may be you have specified specific size for layout_height – vikrant arankalle Nov 14 '17 at 12:32
  • Overlapping issue is not related to your main layout and it should be in item layout you have used in recycle view.Anyway PercentRelativeLayout is deprecated now and you can use Constraint Layout with guide lines instead. – user1688181 Nov 14 '17 at 13:08

1 Answers1

1

change your item_row used in recyclerView

android:layout_height="match_parent"