allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
ependencies {
compile 'com.github.ErChenZhang:StarFloatView:v1.1'
}
<com.smoke.zhangchen.floatviewlib.FloatView
android:id="@+id/float_view"
android:layout_width="match_parent"
android:layout_height="wrap_content
app:childTextColor="#ff0000"
app:defaultViewText="正在生成中"
app:chidTextSize="6sp"
app:parentViewBackground="@mipmap/star_bg"
app:childViewBackground="@drawable/shape_circle">
-
childTextColor:小球文字颜色大小,默认白色
-
defaultViewText:默认小球显示文字
-
parentViewBackground:整体背景
-
childViewBackground:小球背景
-
chidTextSize:小球文字大小,默认6sp
List<Float> list = new ArrayList<>(); list.add((float) 1.245); list.add((float) 1.567); list.add((float) 0.261); floatview.setList(list);
floatview.setOnItemClickListener(new FloatView.OnItemClickListener() {
@Override
public void itemClick(int position, Number value) {
Toast.makeText(MainActivity.this, "当前是第"+position+"个,其值是"+value.floatValue(), Toast.LENGTH_SHORT).show();
}
});