Radio scroll selector, diy rich, damping effect, simple and beautiful, touch or click patterns (Rolling Selector, Diy Rich, Damping Effect, Simple and Beautiful, Touch or Click Mode)
Github Address
YangsBryant/DSelectorBryant
(Github layout is better, it is recommended to enter the details here, if you feel good, the point of a star of it! )
The introduction module
allprojects {
repositories {
google()
JCenter ()
maven { url 'https://www.jitpack.io' }
}
}
implementation 'com.github.YangsBryant:DSelectorBryant:1.0.2'
The main code
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 the onClick (View V) { // pop-up form dSelectorPopup.popOutShadow (constraintLayout); } }); / * Click Listener Tips: implement this listener, click on the button also returns the currently selected item index and text, so can be used as either cancel button used, it can also be used as determined by * / dSelectorPopup.setSelectorListener ( new new DSelectorPopup.SelectorClickListener () { @Override public void onSelectorClick(int position, String text) { Toast.makeText(MainActivity.this,text,Toast.LENGTH_SHORT).show(); //缩回窗体 dSelectorPopup.dismissPopup(); } }); // slider listener / * dSelectorPopup.setSelectoMoverListener (new new DSelectorPopup.SelectorMoveListener () { @Override public void onSelectorMove(int position, String text) { Toast.makeText(MainActivity.this,text,Toast.LENGTH_SHORT).show(); } });*/ } }
Argument Examples
dSelectorPopup.setOffset(5) .setTextSize(30) .setTextcolor_selection(getResources().getColor(R.color.colorAccent)) .setTextcolor_unchecked(getResources().getColor(R.color.colorPrimary)) .setGradual_color(0xffD81B60) .setTitleText ( "I am the heading" ) .setTitleColor(getResources().getColor(R.color.colorPrimary)) .setTitleSize(25) .setButton_background(getResources().getDrawable(R.drawable.popup_bg)).build();
Tips: dividing line of color values: 0xff plus hexadecimal color values, for example: 0xffD81B60
DSelectorBryant property Daquan
Method name | Attributes |
build() | Parameter set up, build it in the last |
setHeights(int height) | PopupWindow height, unit dp |
isOutside(boolean bl) | Click bombs out of the window disappears, default true |
setSeletion(int offset) | Dialog box, the number of items above and below the current item |
setOffset(int seletion) | Item selected by default |
setTextSize(int size) | Text size |
setTextcolor_selection(int textcolor_selection) | Select text color |
setTextcolor_unchecked(int textcolor_unchecked) | Unselected text color |
setGradual_color(int gradual_color) | Dividing line color |
setFining(boolean fining) | Whether to open the parting line tapering ends, default true |
setTitleText(String titleText) | Caption text |
setTitleSize(int titleSize) | Headline text size |
setTitleColor(int titleColor) | Header text color |
setButtonText(String buttonText) | Button text |
setButtonSize(int buttonSize) | Button text size |
setButtonColor(int buttonColor) | Button text color |
setButton_background(Drawable drawable) | Button background |
setButtonWidt(int buttonWidt) | Button width in dp |
setButtonHeight(int buttonHeight) | Button height in dp |
popOutShadow(View view) | Display pop |
dismissPopup() | Close popup |
setSelectorListener(SelectorClickListener selectorListener) | Click Listener |
setSelectoMoverListener(SelectorMoveListener selectoMoverListener) | Slide listeners |