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

  • Home
  • SEARCH
  • 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 6864897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:58:12+00:00 2026-05-27T02:58:12+00:00

May i know how do i align the Button just beside these three Textviews?

  • 0

May i know how do i align the Button just beside these three Textviews? Instead of just below the Textviews.
This is the XML file.

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:orientation="vertical" android:id="@+id/linearlayout1"
        android:background="#000000">

            <TextView android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:id="@+id/textview1"
                android:layout_alignParentLeft="true" android:text="Textview1" />

            <TextView android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="Textview2"
                android:layout_alignParentLeft="true" android:id="@+id/Textview2" />

            <TextView android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:layout_alignParentLeft="true"
                android:text="Textview3" android:id="@+id/Textview3" />

        <RelativeLayout android:id="@+id/relativeLayout2"
            android:layout_width="wrap_content" android:layout_height="wrap_content">
            <Button android:id="@+id/button" android:layout_width="70px"
                android:layout_height="38px" android:text="Button"
                />
        </RelativeLayout>
    </LinearLayout>
</RelativeLayout>
  • 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-27T02:58:13+00:00Added an answer on May 27, 2026 at 2:58 am

    IMO you should put the three textviews and the button in the RelativeLayout, and get rid of the LinearLayout. There’s no point in having two layouts when you can get by with just one, as each ViewGroup adds overhead to the layout and draw passes. Do:

    <RelativeLayout>
        <TextView android:id="@+id/tv1" android:layout_alignParentTop="true" android:layout_alignParentLeft="true"/>
        <TextView android:id="@+id/tv2" android:layout_alignParentLeft="true" android:layout_below="@id/tv1"/>
        <TextView android:id="@+id/tv3" android:layout_alignParentLeft="true" android:layout_below="@id/tv2"/>
        <Button android:id="@+id/btn" android:layout_toRightOf="@id/tv1"/>
    </RelativeLayout>
    

    I didn’t compile this, but it should do what you need. Play around with the layout parameters you give button (you can align it to the top and right of the parent, or to the right of any of the textboxes, etc…).

    The RelativeLayout is very powerful; you should really take advantage of it’s flexibility.

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

Sidebar

Related Questions

You may know this recommendation from Microsoft about the use of exceptions in .NET:
As you may know, when we have this code in Javascript : function getName()
You may know here is a page comparing the XML parsers for Iphone, http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project
You awesome people may know how to do this. I know that once I
As you may know, the standard SWT main loop looks like this: Display display
Some of you may know me from this question: Sticky Footer (not sticking!) Thanks
You may know the scriptaculous SlideUp effect . Well, It slides up a div
As you may know, in VS 2008 ctrl + tab brings up a nifty
As you may know, Silverlight 3 doesn't support IMultiValueConverter and... I badly need it.
As some of you may know, use of the LIMIT keyword in MySQL does

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.