I’ve got a layout problem. What’s odd, I couldn’t find a solution online. Maybe someone here would like to help me?
I would like to display a list like that:

But all I can get is this:

Here’s my xml code for list item:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<ImageView android:id="@android:id/icon" android:layout_width="22px"
android:layout_height="22px" android:layout_marginLeft="4px"
android:layout_marginRight="10px" android:layout_marginTop="4px"
android:src="@drawable/icon" />
<TextView android:id="@android:id/text1" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_marginLeft="4px"
android:layout_marginRight="10px" android:textSize="20px" />
<TextView android:id="@android:id/text2" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_marginLeft="4px"
android:layout_marginRight="10px" android:textSize="20px"
android:layout_alignParentRight="true"
android:layout_weight="0.4" />
</LinearLayout>
I’d appreciate your help, thank you;)
Use
RelativeLayoutin above code not linearlayout becauseandroid:layout_alignParentRight="true"works only relativelatout not linearlayout.