Reputation: 13
how can i put image view
to right of row of a list view
?(square with image to right of row)
I hope that you can help me!
Thanks in advance everybody!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
this is my XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/chk_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" />
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:orientation="vertical"
android:layout_weight="1" >
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/chk_box"
android:textStyle="bold"
android:textColor="#000000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/caratteristica"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/name"
android:layout_toRightOf="@id/chk_box"
android:textStyle="italic" />
</LinearLayout>
<!-- <TextView
android:id="@+id/id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textSize="12sp"
android:textStyle="italic"/>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/dist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/caratteristica"
android:layout_toRightOf="@id/chk_box"
android:textSize="12sp"
android:textStyle="italic" />
<TextView
android:id="@+id/valuta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textSize="12sp"
android:textStyle="italic" />
</LinearLayout>
<EditText
android:layout_width="196dp"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/editText"
android:hint="quantità"
>
</EditText>
</LinearLayout>
</LinearLayout>
AND THIS IS PIC:
Upvotes: 0
Views: 45
Reputation: 4182
Update Your Row to add image in right in center in
I used the image of launcher you use what u take...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/chk_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" />
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:orientation="vertical"
android:layout_weight="1" >
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/chk_box"
android:textStyle="bold"
android:textColor="#000000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/caratteristica"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/name"
android:layout_toRightOf="@id/chk_box"
android:textStyle="italic" />
</LinearLayout>
<!-- <TextView
android:id="@+id/id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textSize="12sp"
android:textStyle="italic"/>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/dist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/caratteristica"
android:layout_toRightOf="@id/chk_box"
android:textSize="12sp"
android:textStyle="italic" />
<TextView
android:id="@+id/valuta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textSize="12sp"
android:textStyle="italic" />
</LinearLayout>
<EditText
android:layout_width="196dp"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/editText"
android:hint="quantità"
>
</EditText>
</LinearLayout>
<ImageView
android:id="@+id/ivImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_gravity="center"
android:src="@mipmap/ic_launcher"
/>
</LinearLayout>
Upvotes: 0
Reputation:
try this may be it helps you
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<ImageView
android:background="@drawable/iconsmile"
android:layout_width="wrap_content"
android:layout_marginRight="10dp"
android:layout_height="wrap_content"
android:id="@+id/checkBox" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:text="I am here for you"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView1" />
<TextView
android:text="I am here for you"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView2" />
<TextView
android:text="I am here for you"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView3" />
</LinearLayout>
</LinearLayout>
Upvotes: 1