2013-07-02 2 views
0

Я создал адаптер customlistview со своим собственным xml, который должен иметь стиль пива с левой стороны, а затем рейтинг avg на правой стороне. Моя проблема в том, некоторые из стилей пива много символов и отрезаны:custom listview adapter xml cut off words

enter image description here

В настоящее время мой XML для элементов списка:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="horizontal" > 

    <TextView 
     android:id="@+id/breweryName" 
     android:layout_width="0dip" 
     android:layout_height="fill_parent" 
     android:text="Large Text" 
     android:layout_weight="4" 
     android:textAppearance="?android:attr/textAppearanceLarge" /> 

    <TextView 
     android:id="@+id/breweryRate" 
     android:layout_width="0dip" 
     android:layout_height="wrap_content" 
     android:text="Large Text" 
     android:layout_weight="1" 
     android:textAppearance="?android:attr/textAppearanceLarge" /> 


</LinearLayout> 

ответ

1

Я думаю, что это может быть, что вы хотите, вам просто нужно wrap_content по имени пива вместо fill_parent, чтобы предотвратить усечение TextView.

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="horizontal" > 

    <TextView 
     android:id="@+id/breweryName" 
     android:layout_width="0dip" 
     android:layout_height="wrap_content" 
     android:text="Large Text" 
     android:layout_weight="4" 
     android:textAppearance="?android:attr/textAppearanceLarge" /> 

    <TextView 
     android:id="@+id/breweryRate" 
     android:layout_width="0dip" 
     android:layout_height="wrap_content" 
     android:text="Large Text" 
     android:layout_weight="1" 
     android:textAppearance="?android:attr/textAppearanceLarge" /> 


</LinearLayout> 
0

Я верю, что вы, вероятно, захотите сделать, это использовать шатер. Я бы изменил ваш xml следующим образом:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="horizontal" > 

    <TextView 
    android:id="@+id/breweryName" 
    android:layout_width="0dip" 
    android:layout_height="fill_parent" 
    android:text="Large Text" 
    android:layout_weight="4" 
    android:ellipsize="marquee" 
    android:marqueeRepeatLimit="marquee_forever" 
    android:singleLine="true" 
    android:textAppearance="?android:attr/textAppearanceLarge" /> 

    <TextView 
    android:id="@+id/breweryRate" 
    android:layout_width="0dip" 
    android:layout_height="wrap_content" 
    android:text="Large Text" 
    android:layout_weight="1" 
    android:textAppearance="?android:attr/textAppearanceLarge" /> 

</LinearLayout>