Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/214.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android中的手柄设计按钮_Android_Android Custom View_Imagebutton_Handle - Fatal编程技术网

Android中的手柄设计按钮

Android中的手柄设计按钮,android,android-custom-view,imagebutton,handle,Android,Android Custom View,Imagebutton,Handle,我已经创造了一个幸运轮旋转与一个简单的按钮现在 想要创建一个这样的手柄/按钮来旋转轮子 任何帮助或线索都将不胜感激。使用旋转动画 Use Rotation animation <?xml version="1.0" encoding="UTF-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1600" android:fro

我已经创造了一个幸运轮旋转与一个简单的按钮现在

想要创建一个这样的手柄/按钮来旋转轮子

任何帮助或线索都将不胜感激。

使用旋转动画
Use Rotation animation 

<?xml version="1.0" encoding="UTF-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="1600"
    android:fromDegrees="0"
    android:interpolator="@android:anim/linear_interpolator"
    android:pivotX="50%"
    android:pivotY="50%"
    android:repeatCount="infinite"
    android:toDegrees="358" /> 
查看此处的“自定义背景”部分:


它包括根据按钮的当前状态更改按钮的图像

我认为您需要创建一个自定义视图,并使用画布绘制旋转手柄。可以绘制一个圆并在其上方写入文本编号,也可以使用预渲染的旋转控制柄图像,使动画从上到下移动。然后,您必须侦听onTouch事件,如果它是从上到下的移动,则为预渲染图像设置动画。如果没有更多的触摸输入,您可以简单地绘制第一个预渲染图像