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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:15:59+00:00 2026-05-28T13:15:59+00:00

This is the layout I am using: <ScrollView xmlns:android=http://schemas.android.com/apk/res/android android:background=@color/background android:layout_width=fill_parent android:layout_height=fill_parent android:padding=30dip >

  • 0

This is the layout I am using:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/background"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="30dip"
>

  <LinearLayout
      android:orientation="vertical"
      android:layout_height="wrap_content"
      android:layout_width="fill_parent" >

    <RelativeLayout
        android:orientation="horizontal"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent" 
        android:gravity="fill_horizontal" 
        >

        <TextView android:id="@+id/poi_name" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
            android:textStyle="bold" 
            android:layout_alignParentLeft="true"
        />

        <ImageView android:id="@+id/internet" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:src="@drawable/internet"
            android:adjustViewBounds="true"
            android:maxHeight="20sp"
        />

    </RelativeLayout>
    ...
  </LinearLayout>
</ScrollView>

However, the text appears aligned to the left but the image appears at the same height than the text (as expected), but horizontally centered in the screen. Why is it not aligned to the right ?
I tried with different combinations of the android:gravity attribute at the RelativeLayout without success.

The maxHeight attribute of the image is set using ‘sp’ units because I want the image to be proportional to the text it is accompanying. Is that correct ?

Thanks for your feedback.

UPDATE:

Thanks to the answer of @danh32 I managed to solve this using a LinearLayout instead of a RelativeLayout. But just out of curiosity: if someone knows what was the problem with the RelativeLayout of my example, I will be grateful.

  • 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-28T13:15:59+00:00Added an answer on May 28, 2026 at 1:15 pm

    Have you tried using textview’s drawableRight attribute to display the image, instead of a standalone imageview? You should be able to change the textview’s width to fill parent and set the drawableRight as your internet drawable.

        <TextView android:id="@+id/poi_name" 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" 
            android:textStyle="bold" 
            android:layout_alignParentLeft="true"
            android:drawableRight="@drawable/internet"
        />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My scenario is like this: <ScrollView android:layout_width=fill_parent android:layout_height=fill_parent android:scrollbars=vertical android:background=#ffffeb> <LinearLayout android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent
I'm using a ListView that is setup like this: <ListView android:id=@android:id/list android:layout_width=fill_parent android:layout_height=fill_parent android:longClickable=false
alt text http://img705.yfrog.com/img705/1337/layoutxt.jpg I already have this layout created using CSS, but its plagued
I am using ScrollView in my Android Layout but it shows IllegalStateException Scrollview can
I'm using this layout to create a 2 column fluid web page. What I
I have this big data-entry sort of page, a table kind of layout using
I'm developing a 3-column website using a layout like this: <div id='left' style='left: 0;
I am following the Android Gallery tutorial ( http://developer.android.com/guide/tutorials/views/hello-gallery.html ) but instead of simple
I am using a layout with Scroll View. But in Logcat I got this
I'm using 4 listviews in my layout and if i use scrollview , i

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.