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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:32:27+00:00 2026-06-08T03:32:27+00:00

The problem I am having is aligning the second TextView to the right of

  • 0

The problem I am having is aligning the second TextView to the right of the TextView which spans to two lines.

I am using a RelativeLayout, but when I use layout_toRightOf it appears at the top of the screen, and when I add layout_alignRight it disappears.

I am very confused how this works. You would assume that it would follow where the first TextView ends, but it does not. Oh, and I am using wrap_content on width and height incase anyone thinks that’s the problem. Thanks in advance.

XML

<TextView 
            android:id="@+id/edit_event_name_show"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="18dp"
            android:textStyle="bold"
            android:layout_marginBottom="5dp"
            android:scrollHorizontally="false"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true" />
        <TextView 
            android:id="@+id/show_event_type"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="10dp"
            android:scrollHorizontally="false"
            android:layout_toRightOf="@+id/edit_event_name_show"
            android:layout_alignBaseline="@+id/edit_event_name_show" />

EDIT: To anyone that ever has a similar issue with trying to align things nicely with TextViews, there is not a way by default. But you can use SpannableString and build them using SpannableStringBuilder.

  • 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-08T03:32:30+00:00Added an answer on June 8, 2026 at 3:32 am

    Third Attempt (Successful Attempt)

    I believe this will help you and be much easier than the other stuff.

    Try using this reference, but change font size instead of color.

    Sam’s answer sums up the link. (in case the link dies at some point.)

    Second Attempt

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    
        <TextView
            android:id="@+id/edit_event_name_show"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:scrollHorizontally="false"
            android:text=" test 1     jfalksjdflkjasdfj"
            android:textSize="18dp"
            android:textStyle="bold" />
    
        <TextView
            android:id="@+id/show_event_type"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/edit_event_name_show"
            android:layout_alignParentRight="true"
            android:scrollHorizontally="false"
            android:text="test2          adjfalsjdfla fa sdfasdf asf a"
            android:textSize="10dp" />
    
    </RelativeLayout>
    

    Picture:

    enter image description here


    First Attempt

    Why not surround your TextViews with a LinearLayout. It will keep them better organized and a little cleaner.

    Try this and let me know how it goes:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >
    
            <TextView
                android:id="@+id/edit_event_name_show"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:scrollHorizontally="false"
                android:text="test1"
                android:textSize="18dp"
                android:textStyle="bold"
                android:layout_weight="1" />
    
            <TextView
                android:id="@+id/show_event_type"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:scrollHorizontally="false"
                android:text="test2"
                android:textSize="10dp"
                android:layout_weight="1" />
        </LinearLayout>
    
    </RelativeLayout>
    

    Picture:

    enter image description here


    With long text:

    enter image description here

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

Sidebar

Related Questions

I'm having problems aligning two spans together. The second span starts slightly lower than
I'm having a problem aligning an image to the top the text in an
I'm having lots of problem aligning an image on CSS. Here is the thing,
I am having problem using mvc:resources in spring 3.1 configuration. Initially i was working
I am having problem with drawing multiple lines during repaint. The code is as
I am having a slight problem aligning my Horizontal Navigation bar to the center
I'm trying to use inheritance in JavaScript here, and I found problem having array
I am having problem aligning text vertically at the top of the span. vertical-align:
I am having a problem with the aligning of an image (float left) and
I was having a small problem with center aligning a DIV in IE7 and

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.