gpt4 book ai didi

android - 具有自定义背景的 TextView 中的表情符号模糊

转载 作者:行者123 更新时间:2023-11-29 23:51:54 25 4
gpt4 key购买 nike

创建带有自定义背景的textview时遇到问题

问题是这样的:
this is how the problem looks like

我想让它看起来像这样:
i want to make it looks like this

这是我的 TextView XML 代码

<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginBottom="4dp"
android:textIsSelectable="true"
android:layout_below="@+id/timestamp"
android:background="@drawable/custom_bg"
android:text=""
android:textSize="14dp" />

这是我的 custom_bg.xml

<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

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


<padding
android:left="10dp"
android:top="4dp"
android:right="10dp"
android:bottom="4dp" >
</padding>

<corners
android:radius="5dp" >
</corners>

</shape>

最佳答案

将颜色(透明以外的任何颜色)设置为textview,表情符号透明度问题就解决了:

textView.setTextColor(getResources().getColor(R.color.white));

关于android - 具有自定义背景的 TextView 中的表情符号模糊,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50835849/

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