我要做的就是当页面有更多数据时,页面底部应该有一些指示,如三个点或类似的东西,以便用户知道有更多记录并滚动它
这里在页面底部没有迹象表明还有更多记录。当有更多数据时,我想添加该指示签名。
我要做的就是当页面有更多数据时,页面底部应该有一些指示,如三个点或类似的东西,以便用户知道有更多记录并滚动它
这里在页面底部没有迹象表明还有更多记录。当有更多数据时,我想添加该指示签名。
A possible solution is to add a View (a layout with a textView or ImageView) beneath your ListView:
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
</ListView>
<LinearLayout
android:id="@+id/viewid"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0" />
The weights are important to show both components. After that, implements the listView's onScrollListener.
setOnScrollListener(new OnScrollListener() {
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
//get the showed item num, and if its equal to total, you can hide the view
//get a reference to your viewid
viewid.setVisibility(View.GONE);
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
});
When it reaches the last line, setVisibility(View.GONE) for the bottom View. If you want to show this View again, when user scrolls up, modify the code. Of course, you can use aother layout, a textView, or something else.
UPDATE
I played with the a layout a little bit, and there is an other solution for your layout file, where the bottom View is overlaying the listView, so the removing of this textView is smooth.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="5dp"
android:background="#ffffff"
android:layout_alignParentBottom="true"
android:text="..." />
</RelativeLayout>