how to create pagenation in dynamic table view in android -
paginationlayout paginationlayout = new paginationlayout(this); paginationlayout.setlayoutparams(new layoutparams(layoutparams.fill_parent, layoutparams.fill_parent)); // creates content sample tablelayout table = new tablelayout(this); table.setlayoutparams(new layoutparams(layoutparams.fill_parent, layoutparams.fill_parent)); table.setgravity(gravity.center_horizontal|gravity.center_vertical); tablerow row = new tablerow(this); row.setlayoutparams(new layoutparams(layoutparams.fill_parent, layoutparams.fill_parent)); table.addview(row); tablerow row2 = new tablerow(this); row2.setlayoutparams(new layoutparams(layoutparams.fill_parent, layoutparams.fill_parent)); table.addview(row2); for(int = 0; i< 50;i++){ button button = new button(this); button.settext("button " + i); if (i%2==0) { row.addview(button); } else { row2.addview(button); } } // add content in pagination paginationlayout.addview(table); // set pagination layout setcontentview(paginationlayout); }
first thing pagination better use listview instead of tablelayout. listview data , ui managed adapter easily.
see example
Comments
Post a Comment