W I Z A R D
W I Z A R D

Reputation: 1224

ListView scroll clicked item to center of the ListView

In my application i have an horizontal listview where it contains 20 to 30 items, in listview it is showing 5 item, and when i click any item (accept first two and last two items) it should move to center of the listview how can i do that please help thanks in advance

Upvotes: 0

Views: 1021

Answers (1)

CompEng
CompEng

Reputation: 7376

You can do it like ;

  1. In your arraylist (or list what you use) you change the order. I mean if you click 1.item you should reorder with replace your 1.item to middle of the item.
  2. Then you can set your adapter again.
  3. Then you can set your list (list.adapter)
  4. Then you can adapter.notifyDataSetChanged();
  5. Then you can list.setSelection(index);

Upvotes: 1

Related Questions