Moving the image according to the Button click

后端 未结 1 1022
情深已故
情深已故 2021-01-14 21:27

I used four buttons (Up,down,Left,Right) and also i have image. I have to move the image accordingly when i press UP button i should move image in upward direction and when

相关标签:
1条回答
  • 2021-01-14 22:11

    I think the problem is (int)getRawx(); and (int)getRawy();, you are calling this methods on Activity and I'm not so sure you really need those values.

    you could try:

    mParams.leftMargin += 50;
    

    or

    int x = mParams.leftMargin;
    mParams.leftMargin = x + 50
    
    0 讨论(0)
提交回复
热议问题