I would like to avoid "Status" of being written on two lines, I'm using constraint layout. I looked other similar questions but I did not find how to solve the problem.
Here is my code:
<?xml version="1.0" encoding="utf-8"?><!--
As recommended by Google, we use a ConstraintLayout
as the root element
We add a padding all around using the padding attribute
-->
<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="20dp"
>
<!--
* We use the hint attribute to display the "type" string
* The type string has been extracted into a dedicated file
* The width is "0dp" because the "match_parent" value cannot be
used with the constraintLayout
* We use the inputType attribute to display the best keyboard
to the user
*
-->
<TextView
android:id="@+id/status_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@id/price"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@id/status"
android:text="Status :"
android:textStyle=""
android:textSize="18sp"
/>
<Spinner
android:id="@+id/status"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintStart_toEndOf="@id/status_label"
app:layout_constraintTop_toTopOf="@id/status_label"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
And here is the view: View
Hope you'll provide some solutions.
You can make the width of status_label
to wrap_content