0

someone could tell me how to write this code → "ImageView1.setX(ImageView1.getX() - 1)" with sdk 10 (Android version 2.3.6 or below) because "setX" and "getX" is with sdk 11.

2 Answers2

0

To get the position of the ImageView, I would use View.getLocationInWindow() and/or View.getLocationOnScreen(). Explore LayoutParams for setting the position of the ImageView. See this: Set the absolute position of a view

Community
  • 1
  • 1
rw.liang1
  • 418
  • 4
  • 12
  • Ok, I will see View.getLocationOnScreen(). http://stackoverflow.com/questions/3294590/set-the-absolute-position-of-a-view-in-android work but is long when I have 10 or more ImageView to move. I have already test these: "ImageView1.setLeft(ImageView1.getLeft() - 1);" "ImageView1.layout(ImageView1.getLeft() - 1, 10, -50, 0);" but don't work. – user3516500 Apr 09 '14 at 19:05
  • I think setLeft() and getLeft() are not available in API10 either. – rw.liang1 Apr 10 '14 at 01:50
0

Finely, Set the absolute position of a view is only reduce the picture not the view, I can't scroll an ImageView with this.

Community
  • 1
  • 1