开发者

Making a scrollable TableLayout display a message if it is empty

I have a TableLayout embedded in a ScrollView so it can scroll. It is set up like this (nothing really special about it):

<ScrollView android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@id/rejectDataTypeButton"
    android:layout_above="@id/datalist_nextButton" >

    <TableLayout android:id="@+id/dataListTable"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:stretchColumns="1" />

</ScrollView>

How do I make it display a message if it is empty, similar to the way ListActivity 开发者_Go百科does it? Is it even possible, since the TableLayout does not have a .setEmptyView(View) method like ListView has?


You could however do it in Java, and if your Array/Result/Whatever is empty, you add a new TableRow with your information message.

The best place to do this (testing if your data-set is empty and displaying the information) is in the onStart-method, thought.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜