My Problem: I am unable to get the last line to appear on some of my TextViews which expand to random sizes based upon content. One particular one which this always occurs is the Comment TextView
.
What I have tried: I have read and tried a number of similar posts here and throughout the web but none seem to resolve the issue. A number of solutions include setting android:gravity="fill"
and android:baselineAligned="false"
which have not had an impact and have removed or changed back to a previous value (noted in code below).
Below I have provided the code specific to the comment TextView
and an image to help understand the layout which it is apart. This is the only TextView
not to the right of its label and baseline aligned. It seems to be a quite common setup, so I'm not sure why the issue exists.
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/colorWhite"
android:padding="5dp"
android:hint="@string/hint_comment"
android:textSize="12sp"
android:gravity="start|top"
android:ems="10"
android:id="@+id/viewComment"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/lbl_View_Comment"
android:layout_marginTop="5dp"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"/>
Change android:layout_height="0dp" to android:layout_height="wrap_content".
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorWhite"
android:padding="5dp"
android:hint="@string/hint_comment"
android:textSize="12sp"
android:gravity="start|top"
android:ems="10"
android:id="@+id/viewComment"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/lbl_View_Comment"
android:layout_marginTop="5dp"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"/>