开发者

Make header permanently visible

In my custom list activity, I have added header in my list activity, it works fine when the list is populated, when it is empty the header also gone, so is there any option to place a permanent header in the list activity.

My XML code is,

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:background="@drawable/background">

<ListView
    android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:layout_marginTop="10dip"
    android:layout_marginBottom="10dip"
    android:drawSelectorOnTop="false"
    android:cacheColorHint="@color/black"/>

<TextView
    android:id="@android:id/empty"
    android:layout_width="fill_p开发者_如何学Carent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:textSize="24dip"
    android:text="@string/empty"/>

ad_header.xml

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/com.example.Password"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical">

<ImageView
    android:id="@+id/add"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:layout_gravity="center"
    android:layout_weight="1"
    android:paddingTop="5dip"
    android:paddingBottom="5dip"
    android:src="@drawable/add_new_item"
    android:background="@color/white"/>

Thanks.


Here is another thread related to your question Android: Adding static header to the top of a ListActivity

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜