您的位置:首页 > 其它

ApiDemo学习 setEmptyView的用法

2013-04-16 15:37 344 查看
其实应该吧emptyView放在 listView的下面

<!--
    The frame layout is here since we will be showing either
    the empty view or the list view.
    -->

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="1" >

        <!--
             Here is the list. Since we are using a ListActivity, we
             have to call it "@android:id/list" so ListActivity will
             find it
        -->

        <ListView
            android:id="@android:id/list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:drawSelectorOnTop="false" />

        <TextView
            android:id="@+id/empty"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="@string/list_8_no_photos" />
    </FrameLayout>
然后list.setEmptyView(findViewById(R.id.empty));

list有数据的时候 textView不会显示 否则就会显示那个 空View
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: