2017-08-02 1 views
0

code I cette mise en page:de ChildView de LinearLayout vers le bas dislocation

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginStart="10dp" 
    android:orientation="horizontal" 
    android:paddingEnd="10dp"> 

    <TextView 
     style="@style/textStyle.Medium.black" 
     android:layout_width="79dp" 
     android:layout_height="wrap_content" 
     android:gravity="center|start" 
     android:minHeight="42dp" 
     android:adjustViewBounds="true" 
     android:text="姓名"/> 

    <TextView 
     android:id="@+id/tv_name" 
     style="@style/textStyle.Medium.subTitle" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="center|end" 
     android:minHeight="42dp" 
     android:adjustViewBounds="true" 
     android:text="暂无"/> 
</LinearLayout> 

enter image description here

mais je composer un texte très long, comme:

<TextView 
     android:id="@+id/tv_name" 
     style="@style/textStyle.Medium.subTitle" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center|end" 
     android:minHeight="42dp" 
     android:adjustViewBounds="true" 
     android:text="暂无+++++++++++++++ 
     +++++++++++++++++++++++++++++++++ 
     ++++++++++++++++++++++++++++++++++ 
     +++++++++++++++"/> 

il:

this text show error, down dislocation

le contenu don ne pas tout montrer, il va dislocation vers le bas.Il cause cause par l'attribut minHeight du premier TextView. Mais je ne descends pas pourquoi?

Désolé, Mon anglais est très pauvre!

+0

ce que l'erreur s'il vous plaît me montrer. – Innocent

+0

Lorsque le contenu est trop long, le TextView ne montre pas tout, il va bouleverser la dislocation –

Répondre

0

essayer cette

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginStart="10dp" 
    android:orientation="horizontal" 
    android:paddingEnd="10dp"> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:adjustViewBounds="true" 
     android:gravity="center|start" 
     android:minHeight="42dp" 
     android:text="姓名" /> 

    <TextView 
     android:id="@+id/tv_name" 

     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:adjustViewBounds="true" 
     android:gravity="center|end" 
     android:minHeight="42dp" 
     android:text="暂无+++++++++++++++ 
    +++++++++++++++++++++++++++++++++ 
    ++++++++++++++++++++++++++++++++++ 
    +++++++++++++++" /> 
</LinearLayout> 
+0

Merci vos votes ~! De cette façon, vous pouvez aligner deux enfants, mais ne pas afficher tout le contenu. –

+0

pouvez-vous expliquer brève –