I have a TextView inside CardView. after rotation (-90 or 270), each textView had different space from ImageView
The result is like this: (https://i.stack.imgur.com/ad9r1.jpg)
XML:
<TextView
android:id="@+id/number"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="123456789"
android:rotation="-90"
app:layout_constraintStart_toEndOf="@id/image_item"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
I tried to put the TextView inside LinearLayout but the output is the same. if there any solution (using just XML) please tell me.
i found this on stackoverflow : Vertical TextView taking too much space in Android but the result is the same and i am looking for solution using XML code
I just changed
layout_height
to0dp
and modified thelayout_constraint
, like the code below:Now, no matter the length of the text, it will be attached to view next to it.