【发布时间】:2018-11-13 02:58:19
【问题描述】:
我有一个TextView 用于RemoteView。但是其中的文字各不相同,因此有时它太长并且被部分截断。我希望我的文本能够自动缩放以适应TextView。我正在使用支持库,但app:autoSizeTextType="uniform" 在RemoteView 中不起作用。还有其他方法吗?
这是 xml 代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="256dp">
<TextView
android:id="@+id/myTextView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:gravity="center_vertical|center_horizontal"
android:text="Some long text here."
android:textSize="26sp" />
</RelativeLayout>
【问题讨论】: