2012-04-09 72 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> 
相关问题