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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:48:34+00:00 2026-05-25T00:48:34+00:00

I am trying to create a layout where there is a RelativeLayout and two

  • 0

I am trying to create a layout where there is a RelativeLayout and two child inside it. The two children are TextView and ImageView. I want the text to start from the very left of the RelativeLayout and ImageView to very right of the RelativeLayout.

What properties I need to use?

The code is which is not working.

<RelativeLayout 
    android:clickable="true"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:background="@drawable/android_btn_large" 
    android:gravity="center_vertical">

    <TextView 
            android:id="@+id/txtButton"
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content"
            android:text="Riverside Park" 
            android:textColor="#FFFFFF"
            android:layout_alignParentLeft="true">
    </TextView>
    <ImageView 
            android:id="@+id/imgButton"
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_alignParentRight="true"
            android:src="@drawable/plus_icon_480">
     </ImageView>
</RelativeLayout>

The above works but stretch the button to fill_parent.

  • 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-25T00:48:34+00:00Added an answer on May 25, 2026 at 12:48 am

    that should do the job

    <RelativeLayout 
        android:clickable="true"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:background="@drawable/android_btn_large"
        android:gravity="center_vertical">
    
    <TextView 
        android:id="@+id/txtButton"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/imgButton"
        android:text="Riverside Park"
        android:textColor="#FFFFFF"
        android:layout_alignParentLeft="true"></TextView>
    
    <ImageView 
        android:id="@id/imgButton"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@+id/txtButton"
        android:layout_centerVertical="true"
        android:layout_alignParentRight="true"
        android:src="@drawable/plus_icon_480">        
    </ImageView>
    </RelativeLayout>
    

    notice that in TextView there is +id, and in ImageView there is no “+””. However you should use linear layout with weight set to “1” on both views.

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

Sidebar

Related Questions

I'm trying to create a layout similar to this: alt text http://img20.imageshack.us/img20/3533/stackn.png Here's the
I'm trying to create a layout not too different from the feed reader sample
I'm trying to create a custom layout for managing preferences. I know there is
I am trying create a layout. There are several inner layouts that should like
I am trying to create a custom title layout but I'd still want to
I am trying to create a dashboard layout. It is different from the google
I'm trying to create a simple HTML layout where there is a header, content
I'm trying to create a custom AlertDialog , and there are two buttons in
I am simply trying to create a layout where there are multiple TextViews (and
Im trying to create a layout in flex using mxml, the layout contains a

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.