I have a layout with a Parent LinearLayout with weightSum of 100 and two child layouts with weights
40 and 60.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:id="@+id/cv_container"
android:layout_width="match_parent"
android:layout_height="150dp"
android:weightSum="100"
android:background="@android:color/white">
<RelativeLayout
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/linearLayout1"
android:layout_weight="40">
<Droid.SquareImageView
android:src="@android:drawable/ic_menu_gallery"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/imgPlaceholderImage"
android:layout_centerInParent="true"
android:scaleType="fitXY" />
<Droid.CustomTextView
android:text="Category"
app:customFont="Fonts/Roboto-Bold.ttf"
android:textSize="12sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:color="@android:color/white"
android:id="@+id/txtCategory"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:ellipsize="end" />
</RelativeLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="match_parent"
android:id="@+id/linearLayout2"
android:layout_weight="60"
android:padding="10dp">
<Droid.CustomTextView
android:text=""
app:customFont="Fonts/Roboto-Bold.ttf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:color="@android:color/black"
android:id="@+id/txtTitle" />
<Droid.CustomTextView
android:text=""
android:textSize="14sp"
app:customFont="Fonts/Roboto-Regular.ttf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:color="#d5d5d5"
android:id="@+id/txtDate" />
<Droid.CustomTextView
android:text=""
app:customFont="Fonts/Roboto-Regular.ttf"
android:textSize="15sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:color="@android:color/black"
android:id="@+id/txtDetail"
android:maxEms="4"
android:ellipsize="end" />
</LinearLayout>
</LinearLayout>
With this I get the layout as so :-
My second row looks fine, but the first one looks weird. Iam using a RecyclerView
.
How can I make my first row look like the second one?