2012-04-09 13 views

Antwort

0

überschreiben OnCreateView wäre der Weg, es zu tun.

Das sagte:
-Wenn Sie Ihre eigene benutzerdefinierte ListView liefern, warum verwenden Sie ListFragment?
-Was sind Anpassungen, die Sie in Ihren ListView aufnehmen? Häufig funktioniert das Standard-ListView, und Anpassungen werden in einem ListAdapter vorgenommen.

+1

Ich habe versucht, [diese] (http://proandroiddev.blogspot.com.br/2012 zu erreichen /01/android-design-tip-drop-shadows-on.html) Effekt, um Schlagschatten anzuwenden. – kaneda

+0

Und ich versuche, dies zu verwenden: http://jasonfry.co.uk/blog/android-overscroll-revisited/ –

0

Aus Informationen aus Android SDK: Using Custom View In XML Based Layout extrahierten, ist es einfach, Ihre Frage zu beantworten:

in Ihrer XML-Layout-Datei statt „Listview“ verwendet wird, einfach den Namen setzen (mit Paketen) in der XML-Datei. Ein Beispiel:

Bevor:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    <ListView android:id="@id/android:list" 
       android:layout_width="match_parent" 
       android:layout_height="0dp" 
       android:background="@color/list_background" 
       android:layout_weight="1" /> 

    <TextView android:id="@id/android:empty" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:background="@color/no_data_list_background" 
       android:text="No data" /> 
</LinearLayout> 

Nach:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    <com.mycompany.BounceListView android:id="@id/android:list" 
       android:layout_width="match_parent" 
       android:layout_height="0dp" 
       android:background="@color/list_background" 
       android:layout_weight="1" /> 

    <TextView android:id="@id/android:empty" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:background="@color/no_data_list_background" 
       android:text="No data" /> 
</LinearLayout> 
Verwandte Themen