使用自定义背景创建textview时出现问题
这是我的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>
答案 0 :(得分:1)
将颜色(透明以外的任何颜色)设置为textview,表情符号透明性问题得到解决:
textView.setTextColor(getResources().getColor(R.color.white));