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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:10:33+00:00 2026-06-07T12:10:33+00:00

Hi i want to put button beside activity title in android. I can change

  • 0

Hi i want to put button beside activity title in android. I can change the text using setTitle() but I haven’t find anything which allows to put button beside title of Activity. I am using android 4.0.3. Can anybody help me?

enter image description here

  • 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-07T12:10:35+00:00Added an answer on June 7, 2026 at 12:10 pm

    Create xml file in your project name topbar.xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="40dp"
        android:orientation="vertical" 
        android:background="@android:color/white">
    
        <TextView 
            android:id="@+id/title_txt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="MyTitle: NameOfUser"
            android:layout_centerVertical="true"
            android:textColor="@android:color/black"
            android:textStyle="bold"
            android:textSize="20sp"
            android:layout_marginLeft="20dp"/>
    
    
        <Button 
            android:id="@+id/back_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:text="Btn"
            android:textColor="@android:color/white"
            android:layout_marginLeft="5dp"
            android:layout_alignParentRight="true"/>
    </RelativeLayout>
    

    And add this layout in any layout by just writing:

    <include layout="@layout/topbar"/>
    

    Hope this will help you.

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

Sidebar

Related Questions

I want to put a button as the text of an @ActionLink() but I
I want put a button on android edittextpreference. I create a custom editextpreference: public
i want to put Go button in android appliation softkeyboard for search and other
I want to put an image on a button, but I want part of
I'm making a toolbar using wxpython and I want to put the Quit button
Problem: I want to put Twitter Share Button in my Google Map InfoWindow. I
I have 3 buttons Docked to left but I want to put them in
hey, hi i want put limit on object creation means a class can have
I am working on eBook app.In that i want to put email button to
I want to put an in ICON into a push button.. the code should

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.