Используйте так же, как показано ниже:
Отредактировано:
<FrameLayout android:id="@+id/linear_Layout_List"
android:layout_gravity="center_horizontal|top|bottom"
android:layout_marginTop="90dip" android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_marginBottom="60dip" android:background="#E4E4E4">
<GridView android:layout_width="fill_parent"
android:layout_gravity="center_horizontal|top|bottom"
android:columnWidth="90dp" android:numColumns="3"
android:horizontalSpacing="10dp" android:stretchMode="columnWidth"
android:gravity="center" android:id="@+id/Search_Result_Grid"
android:background="#E4E4E4" android:focusable="true"
android:verticalSpacing="10dp" android:layout_height="wrap_content"
android:layout_marginBottom="45dip">
</GridView>
<Button android:id="@+id/txt_LoadMoreGrid"
android:layout_width="fill_parent" android:layout_gravity="center_horizontal|bottom"
android:layout_height="wrap_content" android:text="Load More...."
android:clickable="true" android:textColor="#ffffff"
android:visibility="invisible" android:background="@drawable/top_bar_bg"></Button>
</FrameLayout>
и вызов метода onScroll, чтобы скрыть то, что вы хотите ............ эта реализация для функции LOAD MORE в GridView ............. Это работает для я.
grid.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
System.out.println("The first visible Item:"+firstVisibleItem);
if(width<=320 && height<=480)
{
if(firstVisibleItem+5==totalItemCount-1)
{
/*FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT,FrameLayout.LayoutParams.WRAP_CONTENT,Gravity.NO_GRAVITY);
layoutParams.setMargins(0, 0, 0, 45);
grid.setLayoutParams(layoutParams);*/
tv_Load.setVisibility(tv_Load.VISIBLE);
}
else
{
/* FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT,FrameLayout.LayoutParams.WRAP_CONTENT,Gravity.NO_GRAVITY);
layoutParams.setMargins(0, 0, 0, 0);
grid.setLayoutParams(layoutParams);*/
tv_Load.setVisibility(tv_Load.GONE);
}
}
else
{
if(firstVisibleItem+8==totalItemCount-1)
{
/*FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT,FrameLayout.LayoutParams.WRAP_CONTENT,Gravity.NO_GRAVITY);
layoutParams.setMargins(0, 0, 0, 45);
grid.setLayoutParams(layoutParams);*/
tv_Load.setVisibility(tv_Load.VISIBLE);
}
else
{
/* FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT,FrameLayout.LayoutParams.WRAP_CONTENT,Gravity.NO_GRAVITY);
layoutParams.setMargins(0, 0, 0, 0);
grid.setLayoutParams(layoutParams);*/
tv_Load.setVisibility(tv_Load.GONE);
}
}
}
});