Another beautiful component introduced with android material design is Snackbar. Which has the features similar like a Toast message in additional with interaction capability, displays at the bottom of the screen.
In my previous post explained How to create Navigation drawer using android material design. How to use REST web service in xamarin mobile application.
Set up new xamarin android application and add package "Xamarin.Android.Support.Design" Choose one created by xamarin inc.
Let us quickly go through with example code
This is the example code for Snackbar customization.
Check out the complete code at github
Come back here to see more material design UI component stuffs with the next post update.
Set up new xamarin android application and add package "Xamarin.Android.Support.Design" Choose one created by xamarin inc.
Let us quickly go through with example code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//customized snackbar | |
void fnSnackBar( string strText,bool isLengthIndefinite) | |
{ | |
Snackbar objSnackBar = Snackbar.Make (linearLayoutMain, strText, isLengthIndefinite ? Snackbar.LengthIndefinite : Snackbar.LengthShort) | |
.SetAction (Resource.String.retry, (v) => { | |
//set action | |
}); | |
//set action button text color | |
objSnackBar.SetActionTextColor(Android.Graphics.Color.Aqua); | |
Android.Views.View objView = objSnackBar.View; | |
TextView txtAction = objView.FindViewById<TextView> (Resource.Id.snackbar_action); | |
txtAction.SetTextSize (Android.Util.ComplexUnitType.Dip, 18); | |
//set message text color | |
TextView txtMessage = objView.FindViewById<TextView> (Resource.Id.snackbar_text); | |
txtMessage.SetTextColor (Android.Graphics.Color.Red); | |
txtMessage.SetTextSize (Android.Util.ComplexUnitType.Dip, 18); | |
objSnackBar.Show (); | |
} |
Check out the complete code at github
Come back here to see more material design UI component stuffs with the next post update.
No comments:
Post a Comment