0

First of all please note, I don't need to scroll List content, I want to move whole list view. I have a ListView, and I want move whole this view vertically. I can do it by putting list into LinearLayout container, and then call scrollTo(x,y) on that container. Also, I can move my list horizontally, by passing some values to x parameter when calling scrollTo(x,y) directly on my ListView. But changing y and calling that method on ListView has no effect. Maybe someone could suggest a way to move ListView vertically without using extra layouts, margins, invisible headers e t.c. Thanks

OFFmind
  • 597
  • 1
  • 5
  • 13
  • Maybe a picture (quick sketch/mockup) of what you are trying to accomplish would help illustrate the issue more clearly? – Scott W Nov 12 '13 at 14:44
  • I want to move listview a little bit down, by y-axis, like a view. Like a button. So, not a content of the list, but listview itself. I can do such thing with linearLayout by calling scrollTo(0,20). Listview has the same method, but such calling do nothing (not action at all). – OFFmind Nov 12 '13 at 15:05
  • So, there are lots of ways to accomplish moving a View on the screen. Maybe I am just a more visual person, but I was hoping that a picture of what you are trying to accomplish would make the proper solution more obvious. – Scott W Nov 12 '13 at 15:08

1 Answers1

0

if you want to move it on your own (touch) you can put it in a ScrollView (can only host one child), this will let you move the Listview within the ScrollView container.

or, if you want to animate it you could use

ObjectAnimator.ofFloat(yourListView, "y", yNewPosition).setDuration(ANIMATION_TIME).start();
Israel Tabadi
  • 574
  • 4
  • 11
  • If you do end up wanting to put your ListView in a ScrollView, beware of the complications: http://stackoverflow.com/questions/3495890/how-can-i-put-a-listview-into-a-scrollview-without-it-collapsing – Scott W Nov 12 '13 at 16:32