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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:22:06+00:00 2026-05-23T01:22:06+00:00

I create the custom title using the style.I code some from http://labs.makemachine.net/2010/03/custom-android-window-title/ I have

  • 0

I create the custom title using the style.I code some from http://labs.makemachine.net/2010/03/custom-android-window-title/

I have also set the icon in title bar using the setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,R.drawable.title_logo);
can it is possible to set the title bar in middle?if possible then I want set using the custom style.

EDIT: i have check code http://andmobidev.blogspot.com/2010/01/centering-title-of-window.html
it work fine when there no icon in title bar but when set the icon i get the error java.lang.ClassCastException: android.widget.RelativeLayout
i have no idea how the window draw the title bar ,i have check the one of blog
http://android-developers.blogspot.com/2009/03/window-backgrounds-ui-speed.html

Thank you.

  • 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-23T01:22:06+00:00Added an answer on May 23, 2026 at 1:22 am

    I can find the real answer, at last i load the new layout for center the title bar
    set title bar code in Oncreate

     final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    
            setContentView(R.layout.main);
            if (customTitleSupported) {
                getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
                        R.layout.title_bar);
            }
            final TextView myTitleText = (TextView) findViewById(R.id.title_bar);
            if (myTitleText != null) {
                myTitleText.setText(R.string.title_ble_melem);
    
            }
    

    here is the layout

    <?xml version="1.0" encoding="utf-8" ?>
    <RelativeLayout 
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/linear" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        >
        <TextView
            android:id="@+id/title_bar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="title bar"
            android:layout_centerInParent="true"
            android:layout_marginLeft="5dip"
            android:textStyle="bold"
            android:textColor="#ffffff"
            android:textSize="20sp"
           />
    
         <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toLeftOf="@id/title_bar"
            android:src="@drawable/ic_top_bar"
    
        />
        </RelativeLayout >
    

    Thank you very much for response.

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

Sidebar

Related Questions

Like the title says, how do you create custom code snippets in Visual Studio
I'm trying to create a custom drop down and using the code below it
I'd like to create a custom window using WPF that doesn't look like the
I'm trying to programatically create a SharePoint site from a custom template using ASPX
I'm attempting to following the tutorials found here: http://www.ifadey.com/2010/06/crud-using-jquery-and-codeigniter/ My code is updated to
I'm having some errors with my custom recording application using android. I saw most
What is the best way to create a custom title for pages in a
Why do we need to create custom exceptions in .NET?
I need to create a custom membership user and provider for an ASP.NET mvc
I used this guide: http://www.bdunagan.com/2009/06/28/custom-uitableviewcell-from-a-xib-in-interface-builder to be able to create my own custom UITableViewCell

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.