Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9179739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:52:33+00:00 2026-06-17T17:52:33+00:00

Well I guess I ran into some bugs. There seems to be a bug

  • 0

Well I guess I ran into some bugs.

There seems to be a bug with Bitmaps in LayerLists: http://www.michaelpardo.com/2011/10/repeating-bitmaps-inside-layerlists/

I have Layer-List that I want to use as a Background-Drawable in my custom titlebar.

<style name="custom_titlebar_background">
<item name="android:background">@drawable/custom_titlebar_background</item>
</style>

EDIT:
To use the linked workaround I need to set the background of the titlebar programmatically, but I have no idea how. This doesn’t seem to work, It changes the background of the whole screen (including the actual content view):

LayerDrawable layer = (LayerDrawable)getResources().getDrawable(R.drawable.custom_titlebar_background);
        setLayerDrawableBitmapsRepeating(layer);
        getWindow().setBackgroundDrawable(layer);

Is there any way to get a reference to a custom titlebar to call setBackgroundDrawable() or any other way to set the background of a custom titlebar?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:52:34+00:00Added an answer on June 17, 2026 at 5:52 pm

    I found a solution. It is completely dirty and makes use of undocumented Members. This will work at least for me since my custom title bar is only use on 2.x devices to get a Holo-like Look.

    It seems that the android title view has always the same id.

    // http://stackoverflow.com/questions/820398/android-change-custom-title-view-at-run-time
            LayerDrawable layer = (LayerDrawable)getResources().getDrawable(R.drawable.custom_titlebar_background);
            setLayerDrawableBitmapsRepeating(layer);
    
            // get title view and set new background view
            try
            {
                // retrieve value for com.android.internal.R.id.title_container(=0x1020149)
                int titleContainerId = (Integer) Class.forName("com.android.internal.R$id").getField("title_container").get(null);
                View titleView = findViewById(titleContainerId);
    
                if(titleView != null)
                {
                    titleView.setBackgroundDrawable(layer);
                }
            }
            catch(Exception e)
            {
                // nothing, just skip
            }
    

    As long as you are not doing important stuff and your application will still work without it, I see no reason to not use this workaround to fix tileable bitmaps on older Android builds.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well, my website can not redirect to https://www.facebook.com/QuaFootSpa from http://quafootspa.com/ I have tried redirection
I think i ran into a bug, it seems that EF is not handling
I guess you know this file well, it's a file for binding some IP
So I ran into a situation today where some production code was failing precisely
Running OpenSuSE 11.4 - and trying to install WWW::Mechanize::Firefox. Well I guess that I
Well hi, guess what, I have an IE positioning issue! This is in 8,
Well, I have a application which somehow requires some system resources, but how do
well there are 3 activities say Act1 , Act2 and Act3 . in Act1
Well I guess this is not a normal how-to-do-this-or-that stackoverflow question, but perhaps someone
I ran into a small problem with floats that i demonstrate in this fiddle

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.