Git Product home page Git Product logo

android-wheelfortune's Introduction

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()

android-wheelfortune's People

Contributors

jeanboydev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.