I tried searching multiple StackOverflow posts for this, as there seem to be many. I tried many of the solutions including:
Changing the ordering/nesting Adding android:layout_above Adding android:align_bottom Adding android:align_ParentBottom
etc...
The XML looks fine so not sure why its overlapping?
row_layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="100dp"
>
<LinearLayout
android:id="@+id/rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp"
android:weightSum="3"
>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginEnd="10dp"
android:layout_weight=".45"
android:src="@drawable/user" />
<EditText
android:id="@+id/nameOfBusinessET"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2.55"
android:hint="@string/nameOfBusiness"
android:inputType="textPersonName"
android:imeOptions="actionDone"
android:textColorHint="@color/grey" />
</LinearLayout>
<LinearLayout
android:id="@+id/rl2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp"
android:weightSum="3"
>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginEnd="10dp"
android:layout_weight=".45"
android:src="@drawable/user" />
<EditText
android:id="@+id/bizLocationET"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2.55"
android:hint="Location"
android:inputType="textPersonName"
android:imeOptions="actionDone"
android:textColorHint="@color/grey" />
</LinearLayout>
</RelativeLayout>
Try this layout :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="100dp">
<LinearLayout
android:id="@+id/rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="3dp"
android:weightSum="2">
<LinearLayout
android:id="@+id/rl1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:padding="3dp">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:src="@drawable/temp" />
<EditText
android:id="@+id/bizLocationET"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:hint="Location"
android:imeOptions="actionDone"
android:inputType="textPersonName"
android:textColorHint="@color/colorGray" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:padding="3dp">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:src="@drawable/temp" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:hint="Name of business"
android:imeOptions="actionDone"
android:inputType="textPersonName"
android:textColorHint="@color/colorGray" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Take one
Verical Linear layout
-> Twohorizontal linear layout
In every horizontal layout takeimage view
andedittext
.