调整固定到 textview 的 drawabletop 图像的大小

Resizing an drawabletop image fixed to textview

我有一个带有可绘制顶部图像的 TextView,但是图像很大,我需要调整它的大小:

<RelativeLayout 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:id="@+id/main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/football_pitch">

    <TextView
        android:id="@+id/playerNameTop"
        android:layout_width="350dp"
        android:layout_height="358dp"
        android:layout_marginStart="16dp"
        android:drawableTop="@drawable/ic_football_top"
        android:text="TextView"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0" />

</RelativeLayout>

我试图通过设计视图调整它的大小,但当我缩小尺寸时它只会裁剪图像。 如何在不裁剪图像的情况下调整图像本身的大小?

我想如果我把图片变小,我将不得不增加文字大小,我可以做得很好。 所以现在我需要缩小图像,但出于某种原因它也切断了图像的一侧:

[这张图片显示了我通过设计视图调整它的大小。如您所见,它已将底部裁剪掉,因此您看不到文本1

我总是避免使用 drawableTop 和其他类似的东西。以更可定制的方式进行:

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    android:orientation="vertical">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/your_drawable"/>

    <TextView
        android:id="@+id/playerNameTop"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TextView"/>
</LinearLayout>