Android DSelectorBryant 单选滚动选择器的实例代码

Android DSelectorBryant 单选滚动选择器的实例代码,第1张

概述Android DSelectorBryant 单选滚动选择器的实例代码 单选滚动选择器.diy丰富.有阻尼效果.简单美观.触摸or点击模式 (Rolling Selector, Diy Rich, Damping Effect, Simple and Beautiful, Touch or Click Mode) Github地址 YangsBryant/DSelectorBryant (Github排版比较好,建议进入这里查看详情,如果觉得好,点个star吧!) 引入module allprojects { repositories { google() jcen

单选滚动选择器、diy丰富、有阻尼效果、简单美观、触摸or点击模式 (Rolling Selector,Diy Rich,damPing Effect,Simple and Beautiful,touch or Click Mode)

Github地址

YangsBryant/DSelectorBryant

(Github排版比较好,建议进入这里查看详情,如果觉得好,点个star吧!)


引入moduleallprojects { 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) {  //d出窗体  dSelectorPopup.popOutShadow(constraintLayout);  } }); /*点击监听器 Tips:实现此监听器,点击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();  } }); //滑动监听器 /*dSelectorPopup.setSelectoMoverListener(new DSelectorPopup.SelectorMoveListener() {  @OverrIDe  public voID onSelectorMove(int position,Toast.LENGTH_SHORT).show();  } });*/ }}

参数实例

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属性大全

方法名@H_502_34@属性@H_502_34@
build()@H_502_34@参数设置完毕,在最后build一下@H_502_34@
setHeights(int height)@H_502_34@PopupWindow的高度,单位dp@H_502_34@
isOutsIDe(boolean bl)@H_502_34@点击d窗外是否消失,默认true@H_502_34@
setSeletion(int offset)@H_502_34@对话框中当前项上面和下面的项数@H_502_34@
setoffset(int seletion)@H_502_34@默认选中项@H_502_34@
setTextSize(int size)@H_502_34@文本字体大小@H_502_34@
setTextcolor_selection(int textcolor_selection)@H_502_34@选中文本颜色@H_502_34@
setTextcolor_unchecked(int textcolor_unchecked)@H_502_34@未选中文本颜色@H_502_34@
setGradual_color(int gradual_color)@H_502_34@分割线颜色@H_502_34@
setFining(boolean fining)@H_502_34@是否开启分割线两端变细,默认true@H_502_34@
setTitleText(String TitleText)@H_502_34@标题的文字@H_502_34@
setTitleSize(int TitleSize)@H_502_34@标题文字大小@H_502_34@
setTitlecolor(int Titlecolor)@H_502_34@标题文字颜色@H_502_34@
setbuttonText(String buttonText)@H_502_34@按钮文本@H_502_34@
setbuttonSize(int buttonSize)@H_502_34@按钮文字大小@H_502_34@
setbuttoncolor(int buttoncolor)@H_502_34@按钮文字颜色@H_502_34@
setbutton_background(Drawable drawable)@H_502_34@按钮背景@H_502_34@
setbuttonWIDt(int buttonWIDt)@H_502_34@按钮宽度,单位dp@H_502_34@
setbuttonHeight(int buttonHeight)@H_502_34@按钮高度,单位dp@H_502_34@
popOutShadow(VIEw vIEw)@H_502_34@显示d窗@H_502_34@
dismisspopup()@H_502_34@关闭d窗@H_502_34@
setSelectorListener(SelectorClickListener selectorListener)@H_502_34@点击监听器@H_502_34@
setSelectoMoverListener(SelectorMoveListener selectoMoverListener)@H_502_34@滑动监听器@H_502_34@

总结

以上所述是小编给大家介绍的AndroID dselectorBryant 单选滚动选择器的实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对我们网站的支持!如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

总结

以上是内存溢出为你收集整理的Android DSelectorBryant 单选滚动选择器的实例代码全部内容,希望文章能够帮你解决Android DSelectorBryant 单选滚动选择器的实例代码所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1145815.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存