Skip to content

Instantly share code, notes, and snippets.

@rdelrosario
Created November 30, 2017 22:15
Show Gist options
  • Save rdelrosario/06e5e60ce0617876ff89743e23b18d1b to your computer and use it in GitHub Desktop.
Save rdelrosario/06e5e60ce0617876ff89743e23b18d1b to your computer and use it in GitHub Desktop.
Android - Title Background
void UpdateTitleViewLayoutBackground(LinearLayout titleViewLayout, string backgroundResource, Android.Graphics.Drawables.Drawable defaultBackground)
{
if (!string.IsNullOrEmpty(backgroundResource))
{
titleViewLayout?.SetBackgroundResource(this.Context.Resources.GetIdentifier(backgroundResource, "drawable", Android.App.Application.Context.PackageName));
}
else
{
titleViewLayout?.SetBackground(defaultBackground);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment