天天看點

ConstraintLayout 中 TextView 顯示不全

問題描述

當在

ConstraintLayout

限制

TextView

的範圍時,

TextView

中的文字缺失一部分.

<?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="wrap_content"
    android:background="@color/white">

    <android.support.constraint.Guideline
        android:id="@+id/guide"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.5" />

    <TextView
        android:id="@+id/tvOffice"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_marginLeft="@dimen/activity_margin_little"
        android:padding="@dimen/activity_margin"
        android:textColor="@color/nxt_515151"
        android:textSize="@dimen/common_text_size"
        app:layout_constraintEnd_toEndOf="@id/guide"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:text="機構名稱\你說地方水電費所說的發揮" />
</android.support.constraint.ConstraintLayout>

           
ConstraintLayout 中 TextView 顯示不全

解決

  • 修改

    TextView

    的高度屬性為

    wrap_content

<TextView
        android:layout_height="wrap_content"`
    .../>