MaterialShowcaseView icon indicating copy to clipboard operation
MaterialShowcaseView copied to clipboard

change the size of showcase circle

Open MohsenShafiee opened this issue 10 years ago • 7 comments

is it possible to change the size of showcase circle? I mean the focus area? thanks...

MohsenShafiee avatar Sep 08 '15 15:09 MohsenShafiee

MaterialShowcaseView.Builder has following two functions:

builder.setUseAutoRadius(false);
builder.setRadius(radius);

Use those in combination to achieve what you want

MFlisar avatar Sep 08 '15 16:09 MFlisar

thanks :) but what about in sequence mode?

MohsenShafiee avatar Sep 09 '15 10:09 MohsenShafiee

use the addSequenceItem(MaterialShowcaseView sequenceItem) function and create MaterialShowcaseView manually...

MFlisar avatar Sep 09 '15 11:09 MFlisar

ShowcaseConfig config = new ShowcaseConfig(); config.setDelay(1000); MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(MainActivity.this, "2"); sequence.setConfig(config); sequence.addSequenceItem(btnCloseRevealSearch, closeDescription, okDescription); sequence.addSequenceItem(btnOpenRevealSearch, searchDescription, okDescription); sequence.start();

I'm sorry! how to set the setRadius in this code I mean?

MohsenShafiee avatar Sep 09 '15 11:09 MohsenShafiee

Here's my example function I use:

private static MaterialShowcaseView create(Activity activity, View view, int content, String id, Integer radius)
{
    MaterialShowcaseView.Builder builder = new MaterialShowcaseView.Builder(activity)
            .setTarget(view)
            //.setDismissText(button)
            //.setDismissTextColor(Tools.getThemeColor(activity, R.attr.colorPrimary))
            .setMaskColour(Color.argb(150, 0, 0, 0))
            .setContentText(content)
            .setDismissOnTouch(true)
            .setDelay(0); // optional but starting animations immediately in onCreate can make them choppy

    if (radius != null)
    {
        builder.setUseAutoRadius(false);
        builder.setRadius(radius);
    }
    else
        builder.setUseAutoRadius(true);

    if (id != null)
        builder.singleUse(id); // provide a unique ID used to ensure it is only shown once

    MaterialShowcaseView showcaseView = builder.build();
    return showcaseView;
}

Use it like following:

sequence.addSequenceItem(create(...));

MFlisar avatar Sep 09 '15 11:09 MFlisar

thanks a ton...

MohsenShafiee avatar Sep 09 '15 12:09 MohsenShafiee

config.setShapePadding(60 //your prepared size);

amaroukun17 avatar Nov 25 '17 09:11 amaroukun17