Android 自动调整文本视图大小不起作用

Android 自动调整文本视图大小不起作用,android,Android,嗨,我正在android应用程序中使用autosize textview。我的应用程序版本是19,所以我正在使用支持库 有人知道为什么它没有调整大小,因为它的右侧有很多可用空间。将您的android:layout\u height=“wrap\u content”更改为特定值 比如:android:layout\u height=“200dp” 您可以在文档中阅读-: 注意:如果在XML文件中设置了自动调整大小,则不建议对文本视图的布局宽度或布局高度属性使用值“wrap\u content

嗨,我正在android应用程序中使用autosize textview。我的应用程序版本是19,所以我正在使用支持库



有人知道为什么它没有调整大小,因为它的右侧有很多可用空间。

将您的
android:layout\u height=“wrap\u content”
更改为特定值

比如:
android:layout\u height=“200dp”

您可以在文档中阅读-:

注意:如果在XML文件中设置了自动调整大小,则不建议对
文本视图的
布局宽度
布局高度
属性使用值“
wrap\u content
”。它可能会产生意想不到的结果

因此,您必须将一个固定值传递给
文本视图的


希望,这将帮助您

在我的情况下,仅使用固定维度或匹配父项不起作用。我不得不加上“maxLines=1”和“lines=1”。不知道为什么文档中没有明确说明。

可能不起作用,先生@IntelliJAmiya@UltimateDevil明白了。您应该添加静态高度,先生,@IntelliJAmiya:)也许吧,但根据自动调整大小的文档,您必须通过一个固定的height@Nancy,这可能有助于您理解
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="match_parent"
    tools:context="com.app.android.registration.RegistrationActivity"
    tools:ignore="missingPrefix">

    <include
        android:id="@+id/toolbar_registration_layout"
        layout="@layout/toolbar" />

    <TextView
        android:id="@+id/textview_registration_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fontFamily="@font/lato_medium"
        android:padding="8dp"
        android:text="@string/registration_title"
        app:autoSizeTextType="uniform"
        app:layout_constraintTop_toBottomOf="@id/toolbar" />


</android.support.constraint.ConstraintLayout>