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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:36:58+00:00 2026-06-17T03:36:58+00:00

I was wondering what I am doing wrong here, why does surrounding these buttons

  • 0

I was wondering what I am doing wrong here, why does surrounding these buttons in a RelativeLayout cause an error? I haven’t edited layouts much, can I not just stick in a Relative or Linear layout like that?

If I don’t surround the buttons in a layout they appear beneath each other, I am just trying to experiment in having them beside each other horizontally.

I think the way I have done this whole layout is bad because vertically it looks quite squished.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/MainLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >


   <LinearLayout android:id="@+id/topButtons" 
    android:layout_margin="4dip"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <Button android:id="@+id/deviceConnect"
        android:layout_margin="8dip"
        android:layout_weight="3"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:text="Connect2"/>
    <LinearLayout android:orientation="vertical"
        android:layout_weight="1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <LinearLayout android:orientation="horizontal"
            android:layout_margin="8dip"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            <TextView android:text="Connected Adapter:"
                android:layout_gravity="center_vertical"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"/>
            <Spinner android:id="@+id/deviceSpinner"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:drawSelectorOnTop="true"/>
            <TextView android:id="@+id/currentSettings" 
                android:layout_marginLeft="8dip"
                android:text="Current Settings: Not Connected"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"/>
        </LinearLayout>
        <LinearLayout android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
            <LinearLayout android:orientation="horizontal"
                android:layout_margin="8dip"
                android:layout_weight="1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content">
                <TextView android:text="Baud:"
                    android:layout_gravity="center_vertical"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
                <Spinner android:id="@+id/baudSpinner"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:drawSelectorOnTop="true"/>
            </LinearLayout>
            <LinearLayout android:orientation="horizontal"
                android:layout_margin="8dip"
                android:layout_weight="1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content">
                <TextView android:text="Data:"
                    android:layout_gravity="center_vertical"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
                <Spinner android:id="@+id/dataSpinner"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:drawSelectorOnTop="true"/>
            </LinearLayout>
            <LinearLayout android:orientation="horizontal"
                android:layout_margin="8dip"
                android:layout_weight="1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content">
                <TextView android:text="Parity:"
                    android:layout_gravity="center_vertical"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
                <Spinner android:id="@+id/paritySpinner"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:drawSelectorOnTop="true"/>
            </LinearLayout>
            <LinearLayout android:orientation="horizontal"
                android:layout_margin="8dip"
                android:layout_weight="1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content">
                <TextView android:text="Stop:"
                    android:layout_gravity="center_vertical"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
                <Spinner android:id="@+id/stopSpinner"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:drawSelectorOnTop="true"/>
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>
    <Button android:id="@+id/updateSettings"
        android:layout_margin="8dip"
        android:layout_weight="3"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:text="Update\nSettings"/>
</LinearLayout>
<RelativeLayout>
   <Button android:id="@+id/Command"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Test Command"/> 

   <Button android:id="@+id/Command"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Test Command"/> 

   <Button android:id="@+id/Command"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Test Command"/> 

   <Button android:id="@+id/Command"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Test Command"/> 

   <Button android:id="@+id/Command"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Test Command"/> 
    </RelativeLayout>

<jackpal.androidterm.emulatorview.EmulatorView
    android:id="@+id/emulatorView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:focusable="true"
    android:focusableInTouchMode="true"

    />

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="0"
    android:orientation="horizontal" >

    <EditText
        android:id="@+id/term_entry"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:singleLine="true"
        android:imeOptions="actionNone|flagNoExtractUi"
        android:inputType="text|textImeMultiLine" />

    <Button
        android:id="@+id/term_entry_send"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="0"
        android:text="@string/entry_send" />

</LinearLayout>

  • 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-17T03:36:59+00:00Added an answer on June 17, 2026 at 3:36 am

    As others have pointed out already, you need to define a layout_width and layout_height for your RelativeLayout. This should fix your error, unless there are other issues you have. But I thought it was worth noting what the DOCS say about layouts

    A RelativeLayout is a very powerful utility for designing a user interface because it can eliminate nested view groups and keep your layout hierarchy flat, which improves performance. If you find yourself using several nested LinearLayout groups, you may be able to replace them with a single RelativeLayout.

    You have many nested LinearLayouts so you may consider using a RelativeLayout for better performance and readability. You can also use android:orientation="horizontal" in a nested LinearLayout to get your buttons next to each other. But, again, a RelativeLayout may be better in your situation instead of having all of the nested layouts.

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

Sidebar

Related Questions

I am wondering what am I doing wrong here? I cast the void pointer
Here is the code I have, and I'm wondering what I'm doing wrong that
Wondering what I am doing wrong here. I am trying to pass an integer
Just wondering what it is that I am doing wrong here?? It's very simple
I was wondering what am I doing wrong here? I have the following HTML:
I was wondering what I was doing wrong here. The first function runs just
Just wondering what I'm doing wrong here. I've been setting up a linux dev
Im attempting to learn powerscript and was wondering what i'm doing wrong here >
I was wondering if someone could tell me what I am doing wrong that
Im wondering if I'm doing something wrong, or if this is as good a

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.