I am scaling down text size from 30sp to 18sp. But as show in the images below the height and width of text view remains same after scaling, leaving too much space below and above the text.
Original:
Scaled:
How can I resize the view bounds (at least height) so as to fit the new text size and avoid extra space?
I searched but everywhere I found "how to resize text to fit the view bounds". I need to resize view bounds to fix the text size.
Here is my layout file:
<?xml version="1.0" encoding="utf-8"?>
<com.bizlers.soulcube.client.subtitlebehavoir.HeaderView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- Title -->
<TextView
android:id="@+id/header_view_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="30sp" />
<!-- Subtitle -->
<TextView
android:id="@+id/header_view_sub_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="12sp"
android:visibility="gone" />
</com.bizlers.soulcube.client.subtitlebehavoir.HeaderView>