模拟时钟的问题 图片旋转 最近想写一个模拟时钟的插件,也就一个小的widget可以放在桌面上。背景 ,时针 ,分针,秒针 这些图片已经有了,现在问题来了,如何能让时针分针秒针等等绕着一个固定的点进行旋转呢?求解中!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这不是问题,你可以设置rotate属性啊!其中有一个属性就是围绕固定点旋转的!你可以先定义一个.xml文件,在其中设置你想要的结果,然后倒入这个文件!如下,<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"> <rotate android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:fromDegrees="0" android:toDegrees="+360" android:pivotX="50%" android:pivotY="50%" (这两个就是设置固定旋转点) android:duration="1000" /></set> 如果是你自己对图片进行旋转的话,会有点慢,你可以使用 <AnalogClock android:id="@+id/AnalogClock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:dial="@drawable/bg" android:hand_hour="@drawable/hour" android:hand_minute="@drawable/minute"/>秒针呢,则绘制好每一秒对应的图片,贴上去 这样做不可以吧!? 首先起始位置你就不能确定了。肯定刚把widget添加到桌面的时候,就会首先设置时间这时候就需要贴图片了。使用animation的话肯定不行。 当时以前同事在MTK上做过,高了很久。秒钟没做! Android 的问题,log贴出 关于android一个程序运行时出现的错误: 14寸笔记本运行模拟器的尴尬 垂直滚动的TEXTVIEW文本 listview 平滑移动问题 run()发个消息出来让Handler()完成,不直接在run里完成,为什么? 视频通话中,两个surfaceview如何互换各自显示内容? 大神能帮忙分析一下,我会狠狠感谢你们。 android如何在icon图标上显示badge 动态曲线显示的心率计 android 开发环境用什么的好呢? 关于android自带的button资源
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromDegrees="0"
android:toDegrees="+360"
android:pivotX="50%"
android:pivotY="50%" (这两个就是设置固定旋转点)
android:duration="1000" />
</set>
<AnalogClock
android:id="@+id/AnalogClock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:dial="@drawable/bg"
android:hand_hour="@drawable/hour"
android:hand_minute="@drawable/minute"/>秒针呢,则绘制好每一秒对应的图片,贴上去
这样做不可以吧!? 首先起始位置你就不能确定了。肯定刚把widget添加到桌面的时候,就会首先设置时间
这时候就需要贴图片了。使用animation的话肯定不行。