2

I want to move a button with finger moving on and screen. but i can't found any help for this animations with finger motion. i make a fake call apps in which i want to make incoming call layout like below image. how i make a receive or decline button in android:

enter image description here

can i use on-touch event for this animation.

              if (event.getAction()==MotionEvent.ACTION_MOVE) {

                  x=event.getX();
                  RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(300, 60);
                  params.leftMargin = (int)x;

                  btnDeclinecall.setLayoutParams(params);

                           }

                return false;
            }

i use the above codes but it doesn't work for me

4

1 に答える 1

3

See The Code at Android's LockSCreen Slider

FYI:This is not my code, it is from android froyo source code. I also had created the slider in my app using code from above location but that was right slider, So i cant post that code because you need left slider.

so just copy Left slider part from above link and use it with little understanding.

Note:

Above link contain the best and optimized code for slider(But it contain both left and right slider).

so don't waste time anywhere else, It may look little tough in starting but Trust me just try to understand use of private Slider mLeftSlider;in the above link and that will lead you to your destination.

于 2013-02-12T06:15:14.947 に答える