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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:37:38+00:00 2026-06-15T03:37:38+00:00

Im trying to set one textview aligned on the left and two bottons aligned

  • 0

Im trying to set one textview aligned on the left and two bottons aligned on the right as in the image. I’m using margins but I guess this is not the best solution and it’ll change in different phones, anyway my second button doesn’t appear in the app. This is the xml code I have:

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

     <LinearLayout
      android:orientation="horizontal"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:background="#807E7B">     
        <TextView
            android:id="@+id/txtForum"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
                android:textStyle="bold"
                android:textSize="25dp"
                android:textColor="#255094"
                android:layout_marginLeft="5dp"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="5dp"
                >
          </TextView>

        <Button
              android:id="@+id/btnBack"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:gravity="right"
              android:text="New Thread"
              android:layout_marginLeft="80dp"
              android:layout_marginBottom="5dp">
        </Button>

        <Button
              android:id="@+id/btnBrowser"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:gravity="right"
              android:text="Browser"
              android:layout_marginLeft="100dp"
              android:layout_marginBottom="5dp">
        </Button>
    </LinearLayout>

   <ListView
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:cacheColorHint="#00000000">
    </ListView>
</LinearLayout>

This is what I expected:

http://i47.tinypic.com/jheq1k.png

Thanks

  • 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-15T03:37:39+00:00Added an answer on June 15, 2026 at 3:37 am

    use this layout

    <?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"
        android:orientation="vertical"
        android:padding="10dip" >
    
        <RelativeLayout
            android:id="@+id/upperView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/darker_gray"
            android:orientation="vertical"
            android:padding="10dip" >
    
            <TextView
                android:id="@+id/textView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_centerVertical="true"
                android:text="Hello.."
                android:textColor="@android:color/white" />
    
            <Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:text="Button 1" />
    
            <Button
                android:id="@+id/button2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toLeftOf="@+id/button1"
                android:text="Button 2" />
        </RelativeLayout>
    
        <ListView
            android:id="@+id/listView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/upperView" />
    
    </RelativeLayout>
    

    you will end up with

    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 am trying to load/show completely different set of values in a combobox(this one
If I set only one right button on the NavBar it works perfectly. But
I'm trying to set one of two Binding s on a ListBox 's ItemsSource
Trying to set it so if a certain condition is met then one of
I'm trying to set up a slider that uses just one control-menu (e.g. Item
I am trying to set-up the jquery validation plugin and one of my inputs
I am trying to set up a new application and one of the steps
I trying to set separate style for particular widgets, like for one button with
I am trying to set support information on machines with C#. I have one
I'm trying to understand how to set up a one-to-many relationship in Xcode 4.3.1.

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.