0

Basically, the height of TextView increases to the bottom whenever the text goes to a new line. But I want TextView height increase to the top.

Normally this is what happens when text size increases and goes to the new line

Normally this is what happen when text size increases and goes to the new line

And this is what I need when text size increases and goes to the new line

enter image description here

Note: Height of Textview is set to WRAP_CONTENT

Layout

 <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="wrap_content">

<androidx.emoji.widget.EmojiTextView
    android:id="@+id/tv_message"
    style="@style/TvChatMessage.Sent"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:gravity="bottom"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

Style :

<style name="TvChatMessage.Sent">
    <item name="android:fontFamily">@font/work_sans_regular</item>
    <item name="android:lineSpacingExtra">@dimen/dimen_3dp</item>
    <item name="android:paddingStart">@dimen/dimen_10dp</item>
    <item name="android:paddingEnd">@dimen/dimen_10dp</item>
    <item name="android:textSize">@dimen/txt_body_large</item>
    <item name="android:paddingTop">@dimen/dimen_3dp</item>
    <item name="android:textColor">@color/colorWhite</item>
</style>
Anil Bhomi
  • 691
  • 7
  • 12

0 Answers0