gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 18:46:50 30 4
gpt4 key购买 nike

我有一个圆圈 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需要像原来那样是厚白色

enter image description here

但是当我运行它时它看起来像这样

enter image description here

最佳答案

您可以简单地创建一个形状 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>

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

关于android - TextView 中的背景图像显示为透明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51543503/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com