我正在开发一个用于列出在线商店产品的Android应用程序。为此,我使用了GridView
。但是在一个类别中可能会有很多产品,所以我必须实现一个功能,例如“按需加载”,并在gridView
结尾告诉(加载更多)按钮。当然这个按钮只有在GridView
已达到物品末尾时才可见。但我不知道如何去做。以下是我目前的解决方案,但在末尾处出现gridview
时,该按钮不可见。添加页脚到GridView Android
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<com.twotoasters.jazzylistview.JazzyGridView
android:id="@+id/ebuy_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:drawSelectorOnTop="true"
android:horizontalSpacing="15dp"
android:numColumns="2"
android:verticalSpacing="15dp" />
<TextView
android:id="@+id/more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/ebuy_now_background"
android:clickable="true"
android:onClick="loadMore"
android:padding="15dp"
android:text="Load More"
android:textColor="@color/ebuy_color_second_strip"
android:textSize="25sp" />
</LinearLayout>
</ScrollView>
建议或其他解决方案会比欢迎:)更
http://stackoverflow.com/questions/8876596/need-to-create-footer-for-gridview-in-android – 2014-09-01 09:06:27
@ user1728071这个我用过的布局,你的意思了布局GridView的项目 – Xhulio 2014-09-01 09:12:13