欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android自定義view實現(xiàn)拖拽選擇按鈕

 更新時間:2020年05月29日 09:02:30   作者:葉角  
這篇文章主要為大家詳細介紹了Android自定義view實現(xiàn)拖拽選擇按鈕,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了Android實現(xiàn)拖拽選擇按鈕的具體代碼,供大家參考,具體內容如下

github地址:https://github.com/xuezj/DragChooseDemo

DragChooseDemo

效果圖

Attributes屬性(布局文件中的自定義屬性)

半徑、文字大小、按鈕個數(shù)注意配合使用,以達到最佳效果

方法

使用

布局文件中的使用

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

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關文章

最新評論