Following situation: I have a ListFragment, if you click on a list item of it some views inside the list item gets visible, so the list item itself gets expanded. Now, imagine the pressed list item is the last in the list, the expanded part won't be visible. Is there a way to achieve that the list scrolls down a little bit so the complete list item is visible?
Try this: yourListView.scrollTo(0, yourListView.getHeight());
Related
Is there a way to scroll spinner's dropdown list to top so first item is visible regardless which item is currently selected?
Obviously I need only to make vistible the item in the list without any selection.
ListView has smoothScrollToPosition() method to display a specific item in the list but spinner seems not to have a similar behavior.
The attached UI is the calllog. What i am interested is that how the horizontal menu is implemented. When click on one list item, it appeared in one line under the list item.
In the earlier android, one click on list item, we can use Context menu popup menu to show the available action to do.
I am curious that it is using expandable list view concept?
I want to design like that when click on list item to show like this, but my layout would not be the same as this one. I want to put custom layout depending on the list item type. It may include button, textview, other widgets and the layout height will not be the list item height.
Can someone give some suggestion? Thanks a lot.
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.
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
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.
I have a list view in android. And in each list item, user can expand/collapse when click on that list item. My question is how can I make the list view scroll to make the whole list item visible to user as I click the last item item which causes the last list item to expand and hence the list item increase its size (height)?
And same thing goes for when I click the list item to make the list item collapse (which makes it reduces its size)?
Thank you.
You could use:
listView1.smoothScrollToPosition(int position);
Or
listView1.smoothScrollByOffset(int offset);
I want to display a list item that says "More" at the end of my ListView. Clicking on this list-item will perform some action. How can I create this "more" list item?
I don't know about the "Clicking on this list-item will perform some action" part. The typical pattern is that once the user scrolls to the bottom, new material is loaded automatically. Some people do that by detecting the scroll. I do it by putting in a "More" placeholder and detecting when that is used. Here is a component that implements this pattern.
Just add another value to your arrayadapter (or any other adapter), you might be using.set the text to 'more' .
Suppose you have n items in the list then handle the (n+1)th postion click and do your stuff.
You can add a footer to your listview...
Did you check this post out?
Android ListView Footer View not being placed on the bottom of the screen