[Solved] Android studio layout become blank when i enter text into multiline text


Your EditText doesn’t have an id name and you’re missing the “d” in the unit “dp” of the width attribute. Also when you constrain it you mustn’t include the + symbol in the id name of the other view. + is used for new views, not for referencing existing views. Make these changes and you should be fine!

Edit: If you add your xml code, I can pinpoint the specific changes, but I can’t do that if you’re only sharing the images

Edit 2:
When you’re using Left-to-Right layouts it’s redundant to have margin left and margin start, or margin right and margin end, as they’re the same thing. I wasn’t breaking you’re layout but I removed that. Also, I wrapped the height to the contents of your textview.

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

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        android:text="TextView"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <EditText
        android:id="@+id/edittext"
        android:layout_width="215dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="16dp"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="8dp"
        android:autofillHints=""
        android:ems="10"
        android:inputType="textMultiLine"
        android:scrollbarSize="8dp"
        android:scrollbars="horizontal|vertical"
        app:layout_constraintBottom_toTopOf="@id/button2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@id/textView"
        app:layout_constraintTop_toBottomOf="@id/textView"
        tools:ignore="HardcodedText"
        tools:targetApi="o" />

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="16dp"
        android:layout_marginEnd="16dp"
        android:text="Button"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />

    <Button
        android:id="@+id/button3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="12dp"
        android:text="OK"
        app:layout_constraintBaseline_toBaselineOf="@id/button2"
        app:layout_constraintEnd_toStartOf="@id/button2" />

</android.support.constraint.ConstraintLayout>

It doesn’t fail for me now. If it still does for you, chances are you’re giving the same names to textviews of other layouts (each view should have a unique name, as everything is stored in the same R file).

3

solved Android studio layout become blank when i enter text into multiline text