一个下拉提醒Alerter

https://github.com/Tapadoo/Alerter


dependencies {
    implementation 'com.tapadoo.android:alerter:2.0.4'
}


With simplicity in mind, the Alerter employs the builder pattern to facilitate easy integration into any app.

From an Activity -

Alerter.create(this)
       .setTitle("Alert Title")
       .setText("Alert text...")
       .show();

Or from a Fragment -

Alerter.create(getActivity())
       .setTitle("Alert Title")
       .setText("Alert text...")
       .show();

To check if an alert is showing -

Alerter.isShowing();

To hide a currently showing Alert -

Alerter.hide();



譬如

case R.id.Alerter_1:
Alerter.create(this)
        .setTitle("这是一条提醒")
        .setText("这个样式可觉着还行?")
        .setBackgroundColorRes(R.color.colorPrimaryDark) // or setBackgroundColorInt(Color.CYAN)
        .setDuration(10000)
        .setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(MainActivity.this, "还行还行", Toast.LENGTH_LONG).show();
            }})
        .show();
break;

你可能感兴趣的:(一个下拉提醒Alerter)