Android 旋转表盘
来源:互联网 发布:mac tensorflow 安装 编辑:程序博客网 时间:2024/04/19 23:05
使用91手机助手的时候,感觉侧边栏上面的表盘很漂亮,小动画很酷,想在MFC编程的时候,实现这个很困难好像,总之是没有实现过,现在要实现了。
第一步骤:反编译91手机助手的APK,拿到所有的资源文件。用android IDE中的Devices视图,打开那个多个手机重叠的图片,查看他的布局。
第二步骤:不是很正规,我去找drawable下面找图片,把res导入一个新建的工程,搜索图片定位到xml文件,看到,没有使用自定义的控件,就是几个图片,把代码拷贝出来。
<LinearLayout android:gravity="center_horizontal" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="160.0dip" android:layout_weight="1.0"> <RelativeLayout android:layout_width="wrap_content" android:layout_height="120.0dip"> <ImageView android:id="@+id/memory_loading" android:background="@drawable/memory_loading" android:visibility="gone" android:layout_width="125.0dip" android:layout_height="125.0dip" android:layout_marginTop="10.0dip" android:scaleType="fitXY" android:layout_alignParentBottom="true" /> <RelativeLayout android:id="@+id/memorylayout" android:padding="2.0dip" android:visibility="visible" android:layout_width="140.0dip" android:layout_height="140.0dip" android:layout_alignParentBottom="true"> <ImageView android:background="@drawable/memory_value" android:layout_width="110.0dip" android:layout_height="110.0dip" android:layout_centerInParent="true" /> <ImageView android:id="@+id/clear_loading" android:background="@drawable/memory_loading" android:visibility="gone" android:layout_width="110.0dip" android:layout_height="110.0dip" android:layout_centerInParent="true" /> <ImageView android:id="@+id/memory_pointer" android:paddingTop="15.0dip" android:paddingRight="18.0dip" android:layout_width="100.0dip" android:layout_height="100.0dip" android:src="@drawable/memory_point_back" android:scaleType="center" android:layout_centerInParent="true" android:layout_centerHorizontal="true" /> </RelativeLayout> </RelativeLayout> </LinearLayout>添加需要的3个图片资源。
第三步:反编译是拿不到源文件的,明显就是一个动画。自己添加代码,给外层的RelativeLayout添加响应事件:
imageView.getLocationOnScreen(location); int width = ( imageView.getRight() - imageView.getLeft()) / 2; int height = ( imageView.getBottom() - imageView.getTop()) / 2; final Animation animation = new RotateAnimation(0,360,width, height); animation.setDuration(2000); imageView.startAnimation(animation);效果就实现了。
0 0
- Android 旋转表盘
- android 自定义表盘控件
- android自定义表盘
- android 自定义表盘
- Android 仿汽车表盘view
- Android带表盘钟表控件AnalogClock
- android一个简单的自定义表盘
- 绘制模拟Android钟 ####时钟表盘
- android自定义刻度盘 表盘 速度表
- android 自定义view实现表盘效果
- Android 自定义View 实现表盘效果
- Android 自定义view(画表盘)
- Android 自定义View 实现表盘效果
- android 自定义 view 实现表盘效果
- Android 自定义View——表盘实例
- Android手机安全卫士内存占用表盘动画实现
- Android 高级绘图(实例-高级指南针表盘)
- Android自定义View及canvas(表盘实例)
- google vcastr3.0网页播放器
- 【Java.JMS】JMS中的消息的基本结构
- chaussure louboutin pas chere sidewalks
- 如何管理企业合同
- burberry parfum Shijingshan District social work treatment will increase more than 800 yuan per per
- Android 旋转表盘
- tslib移植
- hive报内存不足错误
- 生物信息学之数据库
- NYOJ 14 会场安排问题
- CocosEditor For Java(Cocos2d-Java) 教程聚合和代码下载
- 自动补全输入框中的数据(jquery)
- A004:Linux和Windows的传输
- 剑指Offer22栈的压入、弹出序列