public static void loadPopupData(Context context, final ListView listView) {
final DataBaseManager dbManager1 = new DataBaseManager(context);
final ArrayList<Notify> notifies = dbManager1.getNotificationList(15);
Notifcationadapter adapter = new Notifcationadapter(context, notifies);
listView.setAdapter(adapter);
listView.setEmptyView(emptyView);
}
ListView中发现的物品这种方法是用它来打印数据列表视图:如何显示不在机器人
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/popup"
android:layout_width="fill_parent"
android:layout_height="350dip" >
<RelativeLayout
android:id="@+id/rl_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="10dp"
android:background="#00000000" >
<ImageView
android:id="@+id/image_tringle"
android:layout_width="40px"
android:layout_height="21px"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="50dp"
android:src="@drawable/notficationarrow_icon" />
</RelativeLayout>
<ListView
android:id="@+id/listView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/textView1"
android:background="@anim/notifcationitembroder" >
</ListView>
<TextView android:id="@+id/emptyView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="@+id/listView1"
android:layout_alignBottom="@+id/listView1"
android:gravity="center"
android:visibility="invisible"
android:text="No items in list" />
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/rl_top"
android:background="@drawable/bgnotifcationlayoutback"
android:gravity="center"
android:paddingBottom="20dp"
android:text="Notification"
android:textColor="#666666"
android:paddingTop="2dp"
android:textSize="20dip"
android:textStyle="bold" />
</RelativeLayout>
这是我在哪里打印列表视图的XML文件。
我想在Listview中没有项目的时候它应该显示没有找到Listview我试图做但是无法显示它请建议我如何显示如果在列表视图中没有项目时没有找到项目。
只要检查'arraylist.length()== 0'是否显示你想要的东西。 – Piyush 2014-09-23 05:06:20