没有合适的资源?快使用搜索试试~ 我知道了~
本文实例为大家分享了Android抽奖轮盘的具体代码,供大家参考,具体内容如下 main布局(图片资源请自行寻找,抱歉) <FrameLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:layout_gravity=center> <ImageView android:layout_width=match_parent
资源详情
资源评论
资源推荐
Android抽奖轮盘的制作方法抽奖轮盘的制作方法
本文实例为大家分享了Android抽奖轮盘的具体代码,供大家参考,具体内容如下
main布局(图片资源请自行寻找,抱歉)
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/bigwheelgg"
/>
<ImageView
android:id="@+id/light"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/light"
/>
<ImageView
android:id="@+id/main_wheel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/bigwheel"
/>
<ImageView
android:id="@+id/point"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/point"
/>
</FrameLayout>
main代码
//设置一个时间常量,此常量有两个作用,1.圆灯视图显示与隐藏中间的切换时间;2.指针转一圈所需要的时间,现设置为500毫秒
private static final long ONE_WHEEL_TIME = 500;
//记录圆灯视图是否显示的布尔常量
private boolean lightsOn = true;
//开始转动时候的角度,初始值为0
private int startDegree = 0;
private ImageView lightIv;
private ImageView pointIv;
private ImageView wheelIv;
//指针转圈圈数数据源
private int[] laps = { 5, 7, 10, 15 };
//指针所指向的角度数据源,因为有6个选项,所有此处是6个值
private int[] angles = { 0, 60, 120, 180, 240, 300 };
//转盘内容数组
private String[] lotteryStr = { "索尼PSP", "10元红包", "谢谢参与", "DNF钱包",
"OPPO MP3", "5元红包", };
//子线程与UI线程通信的handler对象
private Handler mHandler = new Handler() {
public void handleMessage(android.os.Message msg) {
switch (msg.what) {
case 0:
if (lightsOn) {
// 设置lightIv不可见
weixin_38518006
- 粉丝: 3
- 资源: 996
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0