Skip to content

🤡幸运抽奖转盘,类似于StarMaker直播间抽奖。

License

Notifications You must be signed in to change notification settings

jeanboydev/Android-WheelFortune

Repository files navigation

WheelFortune

幸运抽奖转盘,类似于StarMaker直播间抽奖。

效果图

效果图1 效果图2 效果图3 效果图4

效果图5 点击查看效果视频

使用

  • 设置布局
<com.jeanboy.component.wheelfortune.WheelFortuneView
	android:id="@+id/wheelFortuneView"
  android:layout_width="320dp"
  android:layout_height="320dp"
  android:layout_gravity="center" />
  • 处理回调
val wheelFortuneView = findViewById(R.id.wheelFortuneView)
tv_user_count = findViewById(R.id.tv_user_count)

wheelFortuneView?.setListener(object : WheelFortuneView.WheelStateListener {
  override fun onJoinClick() {
    // join 按钮点击时回调,移除 item
    wheelFortuneView?.toRunning(0)
  }

  override fun onCountChange(count: Int) {
    // item 数量变化回调
    tv_user_count?.text = resources.getString(R.string.user_count, count, dataList.size)
  }

  override fun onRemove(removeData: ItemData) {
		// item 移除时回调
  }
})
  • 处理数据
// 添加数据
wheelFortuneView?.addData(dataList[index])

// 清除数据
wheelFortuneView?.clearData()

About

🤡幸运抽奖转盘,类似于StarMaker直播间抽奖。

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages