How to align the checkboxes in the checkedtextView in android
Asked Answered
T

2

0

I have a scrollView containing a form composed by multiple CheckedTextView, my problem is that the check boxes of these ones are not in the same level, they are at this end of every text, what i want is to have them aligned so it looks good as a form. How to do that? i've been searching for hours but nothing yet.

how i have them :

blablablablablabla x

blablablablablablablablablablablabla x

blabla x

how i want them :

blablablablablabla                   x

blablablablablablablablablablablabla x

blabla                               x
Thrombophlebitis answered 7/10, 2013 at 15:18 Comment(3)
Show your code. Also, a screenshot would be nice.Molder
you are using relativelayout in your checkbox layout?Cathern
i have a scrollview containing a linearlayout in which i put the checkedtextviewThrombophlebitis
T
1

As a solution, I used single checkboxes and textviews

Thrombophlebitis answered 29/10, 2013 at 16:3 Comment(0)
L
2

This may solve the purpose

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
         android:orientation="vertical">

        <CheckedTextView
            android:id="@+id/my_checkedtextview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:checkMark="?android:attr/listChoiceIndicatorMultiple"
            android:checked="true"
            android:clickable="true"
            android:gravity="left|center_vertical"
            android:hint="My text one" />

        <CheckedTextView
            android:id="@+id/my_checkedtextview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:checkMark="?android:attr/listChoiceIndicatorMultiple"
            android:checked="true"
            android:clickable="true"
            android:gravity="left|center_vertical"
            android:hint="Trying a larger text " />

        <CheckedTextView
            android:id="@+id/my_checkedtextview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:checkMark="?android:attr/listChoiceIndicatorMultiple"
            android:checked="true"
            android:clickable="true"
            android:gravity="left|center_vertical"
            android:hint="Checked" />

        <CheckedTextView
            android:id="@+id/my_checkedtextview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:checkMark="?android:attr/listChoiceIndicatorMultiple"
            android:checked="true"
            android:clickable="true"
            android:gravity="left|center_vertical"
            android:hint="text with some more text" />

        <CheckedTextView
            android:id="@+id/my_checkedtextview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:checkMark="?android:attr/listChoiceIndicatorMultiple"
            android:checked="true"
            android:clickable="true"
            android:gravity="left|center_vertical"
            android:hint="Checked" />

        <CheckedTextView
            android:id="@+id/my_checkedtextview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:checkMark="?android:attr/listChoiceIndicatorMultiple"
            android:checked="true"
            android:clickable="true"
            android:gravity="left|center_vertical"
            android:hint="Checked" />
    </LinearLayout>

</ScrollView>

Also attached the output.enter image description here

Lurid answered 7/10, 2013 at 15:49 Comment(3)
this works on a small screen but on tablet screen it does nothingThrombophlebitis
What is the output on tablet?Lurid
same as in my questionThrombophlebitis
T
1

As a solution, I used single checkboxes and textviews

Thrombophlebitis answered 29/10, 2013 at 16:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.