tux-world tux-world -4 years ago 85
Android Question

Crouton: use Builder to set custom font and textSize

Crouton library has

Builder
class that has some methods such as
setTextSize()
,
setFontName()
and etc. How can I use this class to change default this library configuration?

For example:

Crouton.makeText(activity, "HELLO" , Style.ALERT, rootLayout).show();


How can I use a builder for this line?

Answer Source

As long as I could understand your question, you want something like this:



import de.keyboardsurfer.android.widget.crouton.Style.Builder;

Crouton.makeText(activity, "HELLO" , new Style.Builder()
                                                .setTextSize(12)
                                                .setFontName(someFontName)
                                                ...
                                                .build(),
                                     rootLayout)
                                     .show();


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download