mardi 2 juillet 2019

Android - Get the size of a checkbox icon

I have an EditText below a Checkbox.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <CheckBox
        android:id="@+id/confirmation_receipt"
        style="@style/AppTheme.Checkbox"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingStart="@dimen/content_margin_s"
        android:paddingEnd="0dp"
        android:text="@string/bill_payment_confirmation_receipt" />

    <EditText
        android:id="@+id/confirmation_receipt_customer_email"
        style="@style/AppTheme.EditText.Info"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/content_margin_xxxl"
        android:hint="@string/bill_payment_confirmation_receipt_customer_email_hint"
        android:imeOptions="actionDone"
        android:inputType="textEmailAddress|textNoSuggestions"
        android:selectAllOnFocus="true"
        android:visibility="gone" />

</LinearLayout>

Checking the checkbox reveals the EditText.

I would like to align the EditText view with the text of the checkbox. enter image description here

The problem is that I don't know the exact size of the checkbox icon. And oddly, its size changes depending on the device. Is there a way to align them?




Aucun commentaire:

Enregistrer un commentaire