android: set background color for the entire screen dynamically, or how to set actionbar to overlay layout, but not overlap content -


my app uses theme.wallpaper family, means current wallpaper used app's background. may cause readability issues (depending on user's favorite wallpaper) want allow user choose image background.

the way trying implement is:

@override protected void onresume() {     // wallpaper preferences check if user selected wallpaper ,     // display     sharedpreferences wallpaperpref = getsharedpreferences(wallpaperactivity.wallpaper_preferences, mode_private);     int selectedwallpaper = wallpaperpref.getint(wallpaperactivity.selected_wallpaper, 0);     if (selectedwallpaper != 0) {         findviewbyid(r.id.pager).setbackgroundresource(selectedwallpaper);         getsupportactionbar().setbackgrounddrawable(getresources().getdrawable(selectedwallpaper));     } else {         findviewbyid(r.id.pager).setbackgroundcolor(color.transparent);         getsupportactionbar().setbackgrounddrawable(new colordrawable(color.transparent));     }     super.onresume(); } 

the shared preference contains resource id of selected wallpaper.

my problem titlebar , actionbar not respond this. there way make them receive new background?

  1. make background of title bar , action bar transparent.
  2. set window actionbar overlay true.
  3. pad main view height of actionbar actionbar doesn't cover of content.

your actionbar sit on background view, instead of above it. transparent, allow background show through, , not covered actionbar.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -