TextView 中的背景图像显示为透明

Background image in TextView showing up transparent

我有一个圆圈 png,我把它作为背景图像放在 TextView 中。但是,即使我尝试将 alpha 级别设置为“1”,图像仍显示为透明。我的 XML 代码有什么问题吗?

<TextView
            android:id="@+id/timeline_text_details_img"
            android:layout_width="55dp"
            android:layout_height="55dp"
            android:layout_gravity="center"
            android:layout_marginTop="25dp"
            android:background="@drawable/circle"
            android:gravity="center"
            android:textColor="#fff"
            android:textSize="14dp"
            android:alpha="1"
            android:textStyle="bold" />

我想要的圆形png需要像原来那样是粗白的

但是当我 运行 它

时它看起来像这样

您可以简单地创建一个形状 circle.xml 并将其放置在 drawable 中。

<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">

    <stroke
        android:width="2dp"
        android:color="@android:color/white"
        />

    <solid
        android:color="#000000"/>

</shape>

您可以根据需要更改配色方案。