How do I do a floating hint/text in Android Studio?

  android, android-edittext, textview

I have a box to type in the user’s username, and when the area is selected, I want the "username" text to slide up so it is still visible when typing the username. See code for more information.

        android:id="@+id/imageView8"
        android:layout_width="332dp"
        android:layout_height="45dp"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="30dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/imageView7"
        app:srcCompat="@drawable/input_background" />

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:fontFamily="@font/days_one"
        android:gravity="center_vertical"
        android:paddingLeft="10dp"
        android:text="Username"
        android:textColor="#747474"
        app:layout_constraintBottom_toBottomOf="@+id/imageView8"
        app:layout_constraintStart_toStartOf="@+id/imageView8"
        app:layout_constraintTop_toTopOf="@+id/imageView8" />
</androidx.constraintlayout.widget.ConstraintLayout> ```

Source: Android Questions

LEAVE A COMMENT