美文网首页自定义viewAndroid知识Android开发
从顶部下拉出来的的提示控件。

从顶部下拉出来的的提示控件。

作者: d3337c04717c | 来源:发表于2017-02-28 16:36 被阅读179次
    Paste_Image.png Paste_Image.png 1487522070101111.gif

    Icon
    Alerter.create(this)
    .setText("Alert text...")
    .setIcon(R.drawable.ic_face)
    .show();

    1487522135341198.gif

    On screen duration, in milliseconds
    Alerter.create(this)
    .setTitle("Alert Title")
    .setText("Alert text...")
    .setDuration(10000)
    .show();

    Without title
    Alerter.create(this)
    .setText("Alert text...")
    .show();

    1487522220699266.gif

    Adding an On Click Listener
    Alerter.create(ExampleActivity.this)
    .setTitle("Alert Title")
    .setText("Alert text...")
    .setDuration(10000)
    .setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
    Toast.makeText(ExampleActivity.this, "OnClick Called", Toast.LENGTH_LONG).show();
    }
    })
    .show();

    1487522284901989.gif

    Verbose text
    Alerter.create(ExampleActivity.this)
    .setTitle("Alert Title")
    .setText("The alert scales to accommodate larger bodies of text. " +
    "The alert scales to accommodate larger bodies of text. " +
    "The alert scales to accommodate larger bodies of text.")
    .show();

    1487522357887315.gif

    相关文章

      网友评论

        本文标题:从顶部下拉出来的的提示控件。

        本文链接:https://www.haomeiwen.com/subject/pmwxgttx.html