jeudi 23 août 2018

Android: align checkbox-rectangle with text underneath it

I have a Checkbox with a TextView below, this looks like the following:

enter image description here

How can I align the left side of Lorem with the left side of the checkbox?

My layout-file:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="@dimen/letter_standard_padding">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center_vertical"
        android:orientation="horizontal">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent">
            <CheckBox
                android:id="@+id/mobile_text_module_checkbox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        </LinearLayout>

        <TextView
            android:layout_margin="4dp"
            android:id="@+id/title_text_view"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="10"
            android:textColor="@color/abo_accent"
            android:textStyle="bold"
            android:textAppearance="@style/AboLetterText" />

        <ImageButton
            android:visibility="gone"
            android:layout_marginStart="8dp"
            android:background="@drawable/contract_check"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>

    <TextView
        android:id="@+id/content_text_view"
        android:ems="10"
        android:textAppearance="@style/AboLetterText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</LinearLayout>

The problem seems to be that the checkbox itself is bigger than the rectangle:

enter image description here




Aucun commentaire:

Enregistrer un commentaire