如何在安卓工作室中使⌫符号向后兼容?



退格符号"⌫"显示在运行Android API版本28的设备上,但不显示在运行API版本15的模拟器上。我正在使用以下代码。请帮忙

<Button
android:id="@+id/backspace"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#F5F5F5"
android:text="u232b"
android:textSize="35sp"
app:layout_column="0"
app:layout_gravity="fill"
app:layout_row="0"
app:layout_rowWeight="1" />

似乎旧的android版本没有支持此符号的字体,因此您必须为此按钮使用支持的字体系列,您可以在此处检查支持的字体系列并使用下载的字体,您可以在此处查看如何执行此操作,不要忘记旧API的此部分,但此处最低API级别16

并像使用它一样使用

<Button
android:id="@+id/backspace"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#F5F5F5"
android:text="u232b"
android:fontFamily="@font/myfont" //your downloaded font family name
android:textSize="35sp"
/>

如果需要支持 API 15,可以使用

val typeface = resources.getFont(R.font.myfont)
button.typeface = typeface