<TextView
android:id="@ id/pleaseChooseText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="Please Choose your Mood"
android:textColor="@color/white"
android:textStyle="bold"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_marginTop="60dp"
android:layout_marginBottom="15dp"
/>
I want to make this text fill up screen width, how do I do that?
CodePudding user response:
use this
<TextView
android:id="@ id/pleaseChooseText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Please Choose your Mood"
android:textColor="@color/white"
android:textStyle="bold"
android:layout_marginTop="60dp"
android:layout_marginBottom="15dp"
/>
CodePudding user response:
<?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"
tools:context=".MainActivity">
<TextView
android:id="@ id/pleaseChooseText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:textAlignment="center"
android:text="Please Choose your Mood"
android:textColor="@color/black"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="5dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
The important properties here're:
android:layout_height="match_parent"
android:layout_width="match_parent