Benjamin Weiss http://gplus.to/keyboardsurfer Twitter: @keyboardsurfer Senior Software Developer at ImmobilienScout24 Organizer: GDG Android in Berlin Co-Organizer: ● Global Android Dev Camp ● GTUG Community Weekend ● Google I/O Extended Berlin 2012 ● DevFest Berlin 2012
What is a Crouton "A crouton is a piece of sautéed or rebaked bread, often cubed and seasoned, that is used to add texture and flavor to salads [...] as an accompaniment to soups, or eaten as a snack food. The word crouton is derived from the French [...] meaning "crust"." [1]
What does a Crouton look like? Any way you want new Style.Builder() .setDuration(int) //in milliseconds .setTextColor(int) //resId .setBackgroundDrawable(Drawable) //background drawable .setBackgroundColor(int) //resource id .setTileEnabled(boolean) //whether the image should be tiled .setHeight(int) // WRAP_CONTENT or MATCH_PARENT .setImageResource(int) //resId .setTextShadowRadius(float) //shadow radius .setGravity(int) //one of the Gravity constants .setTextAppearance(int) //resId .setInAnimation(Animation) //in animation // more options .build(); //creates the Style
Usage within your code //Crouton with String Crouton. makeText(this, "Hello Crouton", Style.INFO). show(); //Crouton with text resource Crouton. makeText(this, R.string.hello, Style.INFO). show();
Usage within your code //Cancels all pending Croutons Crouton.cancelAllCroutons(); //Clear all Croutons for an Activity Crouton.clearCroutonsForActivity();
Getting started # clones Crouton to your machine git clone git://github.com/keyboardsurfer/Crouton.git # will install Crouton to your local maven repository cd library && mvn install