github地址:https://github.com/xuezj/DragChooseDemo
Attributes属性(布局文件中的自定义属性)
半径、文字大小、按钮个数注意配合使用,以达到最佳效果
方法
使用
布局文件中的使用
<com.xuezj.dragchooselibrary.view.DragChooseView
android:id="@+id/my_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
choose:background_color="#efeff4"
choose:border_color="#ffcfcfd3"
choose:enabled="@mipmap/sliderwifion"
choose:focused="@mipmap/sliderwifioff"
choose:text_size="12sp"
choose:counts="5"
choose:radius="20" />
代码中调用
dragChooseView =(DragChooseView)findViewById(R.id.my_view);
dragChooseView.setTextData("自定义","单选","双选","全选","sss","ddd");
dragChooseView.addOnChooseItemListener(new DragChooseView.OnChooseItemListener() {
@Override
public void chooseItem(int index, String text) {
Toast.makeText(MainActivity.this, text, Toast.LENGTH_SHORT).show();
}
});