출처 : http://sankarganesh-info-exchange.blogspot.com/2011/04/dynamically-loading-datas-in-listview.html

Dynamically Loading Data's (Adding Footer to ListView ) in ListView in Android


Add a footer to List View and when the user clicks that Footer, you can show parse the next set of data and show it in the list.



Step1: Create a Button

<Button android:id="@+id/footer" android:gravity="center"
android:layout_gravity="center"
android:text="My Footer"
android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_weight="1"/>

Step2: Make it as Footer to the List View

ListView myList;
View footerView;
ViewGroup footerViewOriginal = (ViewGroup) findViewById(R.id.footer);
footerView = inflater2.inflate(R.layout.footer,footerViewOriginal);
footerView.findViewById(R.id.footer);
myList.addFooterView(footerView, null, true);

Step3: Create on ClickListener and write the action what you want to perform

footerView.findViewById(R.id.footer).setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return false;

}

+ Recent posts