亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Android DSelectorBryant 單選滾動(dòng)選擇器的實(shí)例代碼

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

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

Github地址

YangsBryant/DSelectorBryant

(Github排版比較好,建議進(jìn)入這里查看詳情,如果覺(jué)得好,點(diǎn)個(gè)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);
  }
 });
 /*點(diǎn)擊監(jiān)聽(tīng)器
 Tips:實(shí)現(xiàn)此監(jiān)聽(tīng)器,點(diǎn)擊button也會(huì)返回當(dāng)前選中項(xiàng)的下標(biāo)和文本,因此button既可以當(dāng)做取消用,也可以當(dāng)做確定用*/
 dSelectorPopup.setSelectorListener(new DSelectorPopup.SelectorClickListener() {
  @Override
  public void onSelectorClick(int position, String text) {
  Toast.makeText(MainActivity.this,text,Toast.LENGTH_SHORT).show();
  //縮回窗體
  dSelectorPopup.dismissPopup();
  }
 });
 //滑動(dòng)監(jiān)聽(tīng)器
 /*dSelectorPopup.setSelectoMoverListener(new DSelectorPopup.SelectorMoveListener() {
  @Override
  public void onSelectorMove(int position, String text) {
  Toast.makeText(MainActivity.this,text,Toast.LENGTH_SHORT).show();
  }
 });*/
 }
}

參數(shù)實(shí)例

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

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

DSelectorBryant屬性大全

方法名 屬性
build() 參數(shù)設(shè)置完畢,在最后build一下
setHeights(int height) PopupWindow的高度,單位dp
isOutside(boolean bl) 點(diǎn)擊彈窗外是否消失,默認(rèn)true
setSeletion(int offset) 對(duì)話框中當(dāng)前項(xiàng)上面和下面的項(xiàng)數(shù)
setOffset(int seletion) 默認(rèn)選中項(xiàng)
setTextSize(int size) 文本字體大小
setTextcolor_selection(int textcolor_selection) 選中文本顏色
setTextcolor_unchecked(int textcolor_unchecked) 未選中文本顏色
setGradual_color(int gradual_color) 分割線顏色
setFining(boolean fining) 是否開(kāi)啟分割線兩端變細(xì),默認(rèn)true
setTitleText(String titleText) 標(biāo)題的文字
setTitleSize(int titleSize) 標(biāo)題文字大小
setTitleColor(int titleColor) 標(biāo)題文字顏色
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) 點(diǎn)擊監(jiān)聽(tīng)器
setSelectoMoverListener(SelectorMoveListener selectoMoverListener) 滑動(dòng)監(jiān)聽(tīng)器

總結(jié)

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

相關(guān)文章

最新評(píng)論