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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:45:22+00:00 2026-06-13T12:45:22+00:00

I have a ListView with custom adapter and a layout for items in this

  • 0

I have a ListView with custom adapter and a layout for items in this List. The layout for the items is just a TextView with an ImageView. The image should be aligned to the right side of the screen. However, the image’s position is shifting a bit, depending on the length of the text in the TextView. This is what it looks like:

screenshot

This is my XML code:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:gravity="center_vertical" >

    <TextView
        android:id="@+id/txtCategoryName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="10"
        android:singleLine="true"
        android:ellipsize="end"
        android:gravity="center_vertical"
        android:paddingTop="5dp"
        android:paddingBottom="5dp"
        android:textColor="@color/list_text_color"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <ImageView
        android:id="@+id/imgArrowRight"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/right_arrow_44"
        android:contentDescription="@string/img_description_right_arrow"
        android:layout_gravity="right" />

</LinearLayout>

How can I make the image be always aligned to the right, without being nudged?

  • 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-13T12:45:23+00:00Added an answer on June 13, 2026 at 12:45 pm

    RelativeLayout should solve your problem nicely using android:layout_alignParentRight and android:layout_alignParentLeft. Something like:

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
    <TextView
        android:id="@+id/txtCategoryName"
        android:layout_alignParentLeft="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:ellipsize="end"
        android:gravity="center_vertical"
        android:paddingTop="5dp"
        android:paddingBottom="5dp"
        android:textColor="@color/list_text_color"
        android:textAppearance="?android:attr/textAppearanceLarge" />
    
    <ImageView
        android:id="@+id/imgArrowRight"
        android:layout_alignParentRight="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/right_arrow_44"
        android:contentDescription="@string/img_description_right_arrow"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a listview connected to a custom array adapter. This list shows information
I have a listview with custom row having a textview and a clickable image
I have a ListView with a custom list adapter (that extends BaseAdapter). My list
I have a custom listView. The main layout xml is something like this: <?xml
I have ListView with custom Adapter which supplies View to ListView in this way:
I'm using a ListView with custom list items (including a button). I have a
I have a listview with a custom adapter. Each listview item has an ImageView.
I have a ListView with custom Adapter . To be honest, I have many
I have a ListView with custom Adapter . I have to add at position
I have a ListView with a custom adapter, and an animation in getView() for

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.