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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:47:54+00:00 2026-05-30T13:47:54+00:00

I have a layout containing two textViews and one ImageView. the first text is

  • 0

I have a layout containing two textViews and one ImageView.

the first text is aligned to the left. The second is also aligned to the left and is below the first text. the image is aligned to the RIGHT! and is aligned to the top of the first text and the bottom of the second text.

I tried to use a RelativeLayout for the job but the Image refuse to align to the right.

Here is my xml

<RelativeLayout
            android:id="@+id/NameAndPhoto"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >
            <LinearLayout
                android:id="@+id/Names"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/FirstName"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="@style/contact_page_name_text_style" >
                </TextView>

                <TextView
                    android:id="@+id/LastName"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="@style/contact_page_name_text_style" >
                </TextView>
            </LinearLayout>

            <ImageView
                android:id="@+id/PersonPhoto"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBottom="@id/Names"
                android:layout_alignParentRight="true"
                android:layout_alignTop="@id/Names"
                android:layout_toRightOf="@id/Names"
                android:contentDescription="@string/contact_page_photo_content_description"
                android:padding="3sp"
                android:scaleType="fitCenter" >
            </ImageView>
        </RelativeLayout>

Please advise.

Thanks, Ika.

  • 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-30T13:47:55+00:00Added an answer on May 30, 2026 at 1:47 pm

    If you wish to use LinearLayout, use width="match_parent" and align by setting gravity="right". So you move text in the view that has the width of the parent.

    As for your placing ImageView in RelativeLayout, you have a contradiction there: android:layout_alignParentRight="true" and android:layout_toRightOf="@id/Names" – two different horizontal placings.

    Also, you can’t use simultaneously bottom and top placing. And you are using them in Image. Again a contradiction.

    And how can you place the Image to the right of the LinearLayout that takes all the width of the root layout? Where could it be placed? Change width of the Names to wrap_content

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

Sidebar

Related Questions

I'm trying to accomplish a layout like the one below: Two float:left divs are
I have two Android projects, a 'library project' containing a custom layout, and an
I have an Activity with a layout containing a custom ImageView and a few
I have an issue with a table containing three cells in one row. Two
i have two horizontal scroll views each containing a linear layout item under it.
I have a problem with a RelativeLayout containing two TextView s and a ImageView
I have a RelativeLayout with two children that are also both RelativeLayout s containing
Setup I have an accordion layout containing a properties panel that nests two inner
I have a fairly complex layout (containing RelativeLayouts, TextViews and ImageViews) that I want
I have a table with two large cells, the left cell containing two drop-downs

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.