CDZ30
CDZ30

Reputation: 141

Setting the check box to the far right in CheckedTextView

I have a problem in the layout. The checkbox in the CheckedTextView is always to the right of the textview. How can I align it to the right edge of the list?

Thank you for your future answers.

Here is my layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<ImageView 
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:src="@drawable/ic_launcher"/>

<CheckedTextView
    android:id="@+id/checkedTextView"
    android:layout_width="match_parent"
    android:layout_height="?android:attr/listPreferredItemHeightSmall"
    android:checkMark="?android:attr/listChoiceIndicatorMultiple"
    android:gravity="right|center_vertical"
    android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
    android:textAppearance="?android:attr/textAppearanceListItemSmall" />

</LinearLayout>

enter image description here

Upvotes: 1

Views: 856

Answers (1)

Gi0rgi0s
Gi0rgi0s

Reputation: 1867

Change android:layout_width="match_parent" of your checkbox to wrap_content.

Upvotes: 1

Related Questions