2016-08-22 1 views
0

Ich verwende dieses Layout in einer SchleuderPrevent Ansichten in Bezug Layout überlappen in Spinner

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center_vertical" 
    android:mode="twoLine" 
    android:paddingEnd="4dp"> 

    <TextView android:id="@+id/text" 
     android:layout_width="match_parent" 
     android:paddingLeft="15dp" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="8dp" 
     android:textAppearance="?attr/textAppearanceListItem" /> 

    <TextView android:id="@+id/text2" 
     android:layout_width="match_parent" 
     android:paddingBottom="14dp" 
     android:paddingLeft="15dp" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/text" 
     android:layout_alignStart="@id/text" 
     android:textAppearance="?attr/textAppearanceListItemSmall" /> 

    <TextView android:id="@+id/text3" 
     android:layout_width="match_parent" 
     android:paddingLeft="15dp" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="8dp" 
     android:textAppearance="?attr/textAppearanceListItemSmall" 
     android:gravity="right" /> 


</RelativeLayout> 

Wenn die ersten Textviews Inhalt zu lang sie auf den dritten Textview überlappen.

Ich habe

versucht
android:layout_weight="1" 
android:ellipsize="none" 
android:maxLines="2" 
android:scrollHorizontally="false" 

auf den ersten Blick, die nichts tut. Ich habe auch versucht, layout_tostartof auf text3 zu setzen, indem ich layout_toleftof auf text 3 setze, was meine Sicht verschwinden lässt, wahrscheinlich vom Spinner weg.

+0

folgt Betrachten 'LinearLayout' mit und stellen Sie dann' layout_weight' Eigenschaft –

+0

Haben Sie text3 Versuchen Sie, unter text2 zu sein (layout_below verwenden)? –

Antwort

0

änderte ich mein Layout zu einem Tablelayout als

<?xml version="1.0" encoding="utf-8"?> 
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center_vertical" 
    android:mode="twoLine" 
    android:paddingEnd="4dp"> 

    <TableRow 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <TextView android:id="@+id/text" 
      android:layout_width="290dp" 
      android:paddingLeft="15dp" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="8dp" 
      android:layout_weight="3" 
      android:textAppearance="?attr/textAppearanceListItem" /> 

     <TextView android:id="@+id/text3" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="8dp" 
      android:textAppearance="?attr/textAppearanceListItemSmall" 
      android:gravity="right" 
      android:layout_weight="1" 
      android:layout_column="44" /> 
    </TableRow> 

    <TextView android:id="@+id/text2" 
     android:layout_width="match_parent" 
     android:paddingBottom="14dp" 
     android:paddingLeft="15dp" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/text" 
     android:layout_alignStart="@id/text" 
     android:textAppearance="?attr/textAppearanceListItemSmall" /> 

</TableLayout> 
Verwandte Themen