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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:32:56+00:00 2026-06-11T11:32:56+00:00

I want to set a button in my Android application that is comprised of

  • 0

I want to set a button in my Android application that is comprised of text (left aligned), image and another text (right aligned).

Button should look like this

Text1, Text2 and image must be customizable from code.

I am a noob in Android development and I only can guess that Text1 and Text2 should be defined as TextView and image should be defined as ImageView. But it is impossible to set them as children to Button because button is not a ViewGroup.

How do I specify it in xml layout file?

  • 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-11T11:32:57+00:00Added an answer on June 11, 2026 at 11:32 am

    Yeah its easy. Place all these component in a single relative layout. Then follow this:

    RelativeLayout rl= ( RelativeLayout ) findViewById(R.layout.relative_layout_id);
    rl.setOnClickListener(this);
    rl.setOnTouchListener(this);
    rl.setOnDragListener(this);
    

    In TouchListener method, you will get a view as a parameter. So you get the id of the view using

    switch(viewObj.getId()
    {
      case R.layout.relative_layout_id :
                 //write your logic here
       break;
    ]
    

    In OnClick method, write your logic, so where ever you perform click on that relative layout your onclick() method will execute.

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

Sidebar

Related Questions

I have an android application that has a button which I want to have
I derived ImageButton from Button class. I want to be able to set text
What I want to do is have two 'frames'. Left and Right. At application
In my application i want to set flag for favorites quote.On button click i
So i have a UIScrollview with UIImageView set with a button, I want to
How do I set a tag for a button programmatically? I later want to
With jQuery UI you can set icons from the framework on button, i want
I have a set of buttons. I want that when I do mouse up
i have four radio buttons , and i want to set a text for
I have a button as in the following: <Button android:text=Submit android:id=@+id/Button01 android:layout_width=fill_parent android:layout_height=wrap_content> </Button>

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.