最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android DSelectorBryant 單選滾動選擇器的實例代碼

 更新時間:2019年10月11日 13:55:21   作者:YangBryant  
本文通過實例代碼給大家介紹了Android DSelectorBryant 單選滾動選擇器的相關(guān)知識,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下

單選滾動選擇器、diy豐富、有阻尼效果、簡單美觀、觸摸or點擊模式 (Rolling Selector, Diy Rich, Damping Effect, Simple and Beautiful, Touch or Click Mode)

Github地址

YangsBryant/DSelectorBryant

(Github排版比較好,建議進入這里查看詳情,如果覺得好,點個star吧!)

引入module
allprojects {
 repositories {
 google()
 jcenter()
 maven { url 'https://www.jitpack.io' }
 }
}
implementation 'com.github.YangsBryant:DSelectorBryant:1.0.2'

主要代碼

public class MainActivity extends AppCompatActivity {
 DSelectorPopup dSelectorPopup;
 ConstraintLayout constraintLayout;
 ArrayList<String> list = new ArrayList<>();
 Button button;
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 for (int i = 0; i <= 10; i++) {
  list.add("YMF"+i);
 }
 dSelectorPopup = new DSelectorPopup(this,list);
 dSelectorPopup.build();
 constraintLayout = findViewById(R.id.main);
 button = findViewById(R.id.button);
 button.setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View v) {
  //彈出窗體
  dSelectorPopup.popOutShadow(constraintLayout);
  }
 });
 /*點擊監(jiān)聽器
 Tips:實現(xiàn)此監(jiān)聽器,點擊button也會返回當前選中項的下標和文本,因此button既可以當做取消用,也可以當做確定用*/
 dSelectorPopup.setSelectorListener(new DSelectorPopup.SelectorClickListener() {
  @Override
  public void onSelectorClick(int position, String text) {
  Toast.makeText(MainActivity.this,text,Toast.LENGTH_SHORT).show();
  //縮回窗體
  dSelectorPopup.dismissPopup();
  }
 });
 //滑動監(jiān)聽器
 /*dSelectorPopup.setSelectoMoverListener(new DSelectorPopup.SelectorMoveListener() {
  @Override
  public void onSelectorMove(int position, String text) {
  Toast.makeText(MainActivity.this,text,Toast.LENGTH_SHORT).show();
  }
 });*/
 }
}

參數(shù)實例

dSelectorPopup.setOffset(5)
  .setTextSize(30)
  .setTextcolor_selection(getResources().getColor(R.color.colorAccent))
  .setTextcolor_unchecked(getResources().getColor(R.color.colorPrimary))
  .setGradual_color(0xffD81B60)
  .setTitleText("我是標題")
  .setTitleColor(getResources().getColor(R.color.colorPrimary))
  .setTitleSize(25)
  .setButton_background(getResources().getDrawable(R.drawable.popup_bg)).build();

Tips:分割線的顏色值為:0xff 加上16進制顏色值,例如:0xffD81B60

DSelectorBryant屬性大全

方法名 屬性
build() 參數(shù)設置完畢,在最后build一下
setHeights(int height) PopupWindow的高度,單位dp
isOutside(boolean bl) 點擊彈窗外是否消失,默認true
setSeletion(int offset) 對話框中當前項上面和下面的項數(shù)
setOffset(int seletion) 默認選中項
setTextSize(int size) 文本字體大小
setTextcolor_selection(int textcolor_selection) 選中文本顏色
setTextcolor_unchecked(int textcolor_unchecked) 未選中文本顏色
setGradual_color(int gradual_color) 分割線顏色
setFining(boolean fining) 是否開啟分割線兩端變細,默認true
setTitleText(String titleText) 標題的文字
setTitleSize(int titleSize) 標題文字大小
setTitleColor(int titleColor) 標題文字顏色
setButtonText(String buttonText) 按鈕文本
setButtonSize(int buttonSize) 按鈕文字大小
setButtonColor(int buttonColor) 按鈕文字顏色
setButton_background(Drawable drawable) 按鈕背景
setButtonWidt(int buttonWidt) 按鈕寬度,單位dp
setButtonHeight(int buttonHeight) 按鈕高度,單位dp
popOutShadow(View view) 顯示彈窗
dismissPopup() 關(guān)閉彈窗
setSelectorListener(SelectorClickListener selectorListener) 點擊監(jiān)聽器
setSelectoMoverListener(SelectorMoveListener selectoMoverListener) 滑動監(jiān)聽器

總結(jié)

以上所述是小編給大家介紹的Android DSelectorBryant 單選滾動選擇器的實例代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!如果你覺得本文對你有幫助,歡迎轉(zhuǎn)載,煩請注明出處,謝謝!

相關(guān)文章

  • Android apk 插件啟動內(nèi)存釋放問題

    Android apk 插件啟動內(nèi)存釋放問題

    這篇文章主要介紹了Android apk 插件啟動內(nèi)存釋放問題的相關(guān)資料,需要的朋友可以參考下
    2017-06-06
  • 使用genymotion訪問本地上Tomcat上數(shù)據(jù)的方法

    使用genymotion訪問本地上Tomcat上數(shù)據(jù)的方法

    下面小編就為大家?guī)硪黄褂胓enymotion訪問本地上Tomcat上數(shù)據(jù)的方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-03-03
  • 最新評論

    淮北市| 南安市| 澎湖县| 麻城市| 安顺市| 东阿县| 巫山县| 永登县| 商城县| 徐汇区| 大田县| 九台市| 延庆县| 红桥区| 东兴市| 上犹县| 舒兰市| 临泉县| 凤台县| 马龙县| 清原| 应城市| 七台河市| 安西县| 银川市| 台中县| 桃园市| 松阳县| 盖州市| 冷水江市| 太原市| 南宫市| 嘉兴市| 吉隆县| 姚安县| 白河县| 万载县| 长治市| 新野县| 北宁市| 南木林县|