ABI
ABI

Reputation: 1556

Android listview row detail page sliding

I have ListView which has many items(rows), onClick of any item goes to the DetailActivity which explains more about that particular item. If I want to see the detail of the next item, I have to come back to the ListView and click next item. How to design to see the next or previous item's detail from DetailActivity by swiping it left or right.

Upvotes: 2

Views: 825

Answers (2)

Sufian
Sufian

Reputation: 6555

You could go with a ExpandableListView. No need to open a new screen or doing something which becomes hard to manage like Fragments. The user can show/hide detail just by clicking on the item.

A view that shows items in a vertically scrolling two-level list. This differs from the ListView by allowing two levels: groups which can individually be expanded to show its children. The items come from the ExpandableListAdapter associated with this view.

Upvotes: 1

I assume that you have a Custom Object and ArrayList of this object. You need to have an adapter to Show this Arraylist into Listview When you clicked the list item you need to pass your object from ListActivity to your DetailActivity

I think you are doing this fine until this part.

Then now, you can use ViewPager and its adapter in your DetailActivity. When you click the list item, you need to pass your Arraylist and your object index to the DetailActivity.

In the DetailActivity, get your Arraylist, set your List into ViewPager adapter, find your object via index(that you clicked) and set ViewPager page index as your wanted item index.

If you manage this correctly, you can slide details of your content. You can ask ma anything to make this clear.

There is a tutorial of Using the ViewPager: http://architects.dzone.com/articles/android-tutorial-using

Upvotes: 1

Related Questions