Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why layout editor in android studio working incorrectly?

I have the problem, which is that layout editor in android studio displays layout incorrectly.screen from android studio

I think that is layout haven’t missing some attribute like xmlns:tools="".

It looks like your post is mostly code; please add some more details.
It looks like your post is mostly code; please add some more details 😀

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Layout code is below
`

<TextView
    android:id="@+id/tv_title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="52dp"
    android:text="@string/registration_title"
    android:textSize="30sp" />

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/name_input_layout"
    android:layout_width="250dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="48dp"
    app:counterEnabled="true"
    app:counterMaxLength="25"
    app:errorEnabled="true">

    <com.google.android.material.textfield.TextInputEditText
        android:id="@+id/et_name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/registration_hint_name" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/login_input_layout"
    android:layout_width="250dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    app:counterEnabled="true"
    app:counterMaxLength="25"
    app:errorEnabled="true">

    <com.google.android.material.textfield.TextInputEditText
        android:id="@+id/et_login"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:hint="@string/registration_hint_login" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/password_input_layout"
    android:layout_width="250dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    app:counterEnabled="true"
    app:counterMaxLength="25"
    app:endIconMode="password_toggle"
    app:errorEnabled="true">

    <com.google.android.material.textfield.TextInputEditText
        android:id="@+id/et_password"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:inputType="textPassword"
        android:hint="@string/registration_hint_password" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/repeated_password_input_layout"
    android:layout_width="250dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    app:counterEnabled="true"
    app:endIconMode="password_toggle"
    app:counterMaxLength="25">

    <com.google.android.material.textfield.TextInputEditText
        android:id="@+id/et_repeated_password"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:inputType="textPassword"
        android:hint="@string/registration_hint_password_repeat" />

</com.google.android.material.textfield.TextInputLayout>

<Button
    android:id="@+id/btn_register"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="32dp"
    android:text="@string/registration_button_register" />


</LinearLayout>

`

>Solution :

In Android Studio, the layout that is shown in editor is just a preview that does not know about the theme which we set in AndroidManifest.xml.
So we should change the theme in the editor to see the correct preview.

Well, To change the theme just select the correct theme in the top of your editor. (the dropdown which is selected "Light" in your picture that you shared)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading