2017-10-07 12 views
0

こんにちは、私はあなたのAndroidアプリケーションで自動サイズ調整のテキストビューを使用しています。私のアプリケーションminSdkVersionは19ですので、サポートライブラリを使用しています。 自動サイズ調整のテキストビューが機能していません

enter image description here

<?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> 

https://developer.android.com/guide/topics/ui/look-and-feel/autosizing-textview.html

は、誰もがそれの右側に利用可能なスペースがたくさんあるとして、それがリサイズされていない理由を知っています。

+0

は先生をすることができないのに役立ちます、TextView

希望のandroid:layout_heightに固定値を渡す必要があり、@IntelliJAmiya – UltimateDevil

+1

@UltimateDevilを得ましたポイント。あなたは静的な高さを追加する必要があります –

+1

MyPleasure Sir、@IntelliJAmiya :) – UltimateDevil

答えて

1
はあなた android:layout_height="wrap_content"

と同様に特定の値に変更し

android:layout_height="200dp"

あなたはドキュメントで読むことができ

- :

を:あなたはXMLファイルで自動サイズ設定されている場合、それはlayout_widthまたはlayout_height属性に「wrap_content」という値を使用することはお勧めしません。TextView。予期しない結果が生じることがあります。

enter image description here

だから、あなたはこれがあなた

+0

しかし、テキストビューの固定高さはうまくいきません –

+0

おそらく、自動サイズ調整のための文書によると、固定高さ – UltimateDevil

+0

@Nancy、this [video](https ://www.youtube.com/watch?v = fjUdJ2aVqE4)を理解するのに役立ちます – UltimateDevil

関連する問題