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 6248317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:02:05+00:00 2026-05-24T13:02:05+00:00

I have added a custom titlebar using the following code. However, I seem to

  • 0

I have added a custom titlebar using the following code. However, I seem to have about 10 px spacing left and right a 2px at the bottom, is there any way I can make the custom titlebar fit the titlebar area?

customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.tab);
        Display display = getWindowManager().getDefaultDisplay(); 
        
        if (customTitleSupported) {
            getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
                            R.layout.titlebar);
            
            LinearLayout titlebar = (LinearLayout) findViewById(R.id.TitleBarLayOut);
            titlebar.setPadding(-2, -1, -2, -1);
            titlebar.setMinimumWidth(display.getWidth());
            GradientDrawable grad = new GradientDrawable(Orientation.TOP_BOTTOM,
                      new int[] {Color.RED, Color.YELLOW}
                    );
            titlebar.setBackgroundDrawable(grad);

            playButton = new Button(this);
            playButton.setText("Play");
            playButton.setGravity(Gravity.LEFT);
            
            infoButton = new Button( this );
            infoButton.setText("Info");
            infoButton.setGravity(Gravity.RIGHT);
            
            titlebar.addView(playButton, new LinearLayout.LayoutParams(
                      70,1));
            
            titlebar.addView(infoButton, new LinearLayout.LayoutParams(
                  70,1));
            
            
        }


<?xml version="1.0" encoding="utf-8"?>

  • 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-05-24T13:02:06+00:00Added an answer on May 24, 2026 at 1:02 pm

    You want to fill the background of the actual title bar – not your custom area.
    Try the solution here worked for me: Set title background color

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

Sidebar

Related Questions

I have added a custom page to my installer created using nsDialogs, however, the
'm using GAPI version 1.3 I have added a custom variable in GA code
In Silverlight 3.0 I have added a custom behavior to some UIElement in Code
I am using jquery validation plugin for form validation. I have added a custom
I have a list within Sharepoint, using a custom new form I have added
I have added a few custom MenuItem objects to a ContextMenuStrip control. However, adding
I have added a menu item in edit control block(ECB) in document library(using following
I have added custom attribute with the code my_price with Catalog Input Type for
I have added a custom action to the CustomList type. For testing purposes I
I'm trying to make a custom infowindow. Version = 2. I have added my

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.