如何动画按钮用手指ontouch事件的android? [英] how to animate button with finger ontouch event android?
问题描述
我想搬到一个按钮用手指在移动和屏幕。但我不能找到任何帮助这个动画用手指运动。我做的,我想做出类似下面的图像来电布局的假电话应用程序。如何使一个接收或Android的下降键:
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:
我可以使用触摸事件的这个动画。
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;
}
我用上面的codeS,但它不为我工作。
i use the above codes but it doesn't work for me
推荐答案
请参阅该code在<一个href="http://grep$c$c.com/file_/repository.grep$c$c.com/java/ext/com.google.android/android/2.2_r1.1/com/android/internal/widget/SlidingTab.java/?v=source"相对=nofollow> Android的锁屏滑块
供参考:这不是我的code,它是从Android的Froyo的来源$ C $ C。 我也一直在使用code从上述位置创建滑块在我的应用程序,但是,这是正确的滑块,是因为你需要左边的滑块我不能张贴code。
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.
注:
上面的链接包含最优化$ C $下滑块(但它同时包含左,右滑块)。
Above link contain the best and optimized code for slider(But it contain both left and right slider).
所以不要浪费时间在其他地方,它可能看起来有点艰难的开始,但相信我只是试着去了解使用私人滑块mLeftSlider;
在上面的链接,这将导致你到你的目的地。
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.
这篇关于如何动画按钮用手指ontouch事件的android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!