'Android - TextView text is hidden under button
I have a TextView text and it is hidden under button and not wrapped before button. It looks like text is ignoring button and wrapping at the end of line. How to wrap the text before button?
This is how it looks like now:

This is my code:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
android:padding="16dp"
tools:context="com.test.TestActivity">
<TextView
android:id="@+id/status_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Status"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/wifi_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:importantForAccessibility="no"
app:layout_constraintBottom_toBottomOf="@id/wifi_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/wifi_text"
app:srcCompat="@drawable/ic_wifi" />
<TextView
android:id="@+id/wifi_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="32dp"
android:text="Wi-Fi: some longer text should be on two lines and it is not on two lines"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/status_text" />
<Button
android:id="@+id/wifi_settings_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Set"
app:layout_constraintBottom_toBottomOf="@id/wifi_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/wifi_text" />
</androidx.constraintlayout.widget.ConstraintLayout>
How to wrap text before Set button?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
