2012-04-09 75 views

回答

0

覆蓋onCreateView將是做到這一點的方法。

那麼說:
- 如果你提供自己的自定義ListView,爲什麼你使用ListFragment?
- 您在ListView中包含哪些自定義設置?通常默認的ListView工作,並且自定義進入ListAdapter。

+1

我試圖實現[這](http://proandroiddev.blogspot.com.br/2012 /01/android-design-tip-drop-shadows-on.html)效果,以應用投影。 – kaneda 2012-04-09 18:32:07

+0

我想用這個:http://jasonfry.co.uk/blog/android-overscroll-revisited/ – 2012-11-30 19:07:06

0

從從Android SDK: Using Custom View In XML Based Layout提取的信息,很容易回答你的問題:

在你的XML佈局文件,在XML文件中,而不是使用「ListView控件」,只是把名字(與包)。舉個例子:

前:

​​

後:

<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> 
相關問題