在Android Edittext中实现autoSizeTextType [英] Implement autoSizeTextType in android Edittext
本文介绍了在Android Edittext中实现autoSizeTextType的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Android Oreo buildToolsVersion提供了一种简化的方法来自动调整AppCompatTextView中的文本大小,如下所示
Android Oreo buildToolsVersion provides a simplified way to autoresize textsize in AppCompatTextView as follows
<android.support.v7.widget.AppCompatTextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:maxWidth="300dp"
android:background="@android:color/holo_green_light"
app:autoSizeTextType="uniform"
app:autoSizeMinTextSize="5sp"
app:autoSizeMaxTextSize="50sp"
app:autoSizeStepGranularity="4sp"
/>
由于基本上是TextView的扩展,因此可以将类似的实现应用于AppCompatEditText吗?仅仅将autoSizeTextType应用于AppCompatEditText似乎不起作用.有办法解决这个问题吗?
Can a similar implementation be applied to AppCompatEditText since it is basically an extension of TextView? Simply applying autoSizeTextType to AppCompatEditText doesn't seem to work. Is there a way to make this work out?
推荐答案
不,您不能.请参阅此处;由于不支持,因此所有AppCompatEditText均将其禁用.
No you cannot. Please see here; it is disabled for all AppCompatEditText since it is not supported.
这篇关于在Android Edittext中实现autoSizeTextType的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文