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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:40:53+00:00 2026-05-27T16:40:53+00:00

I am trying to create a layout but I am not too sure how

  • 0

I am trying to create a layout but I am not too sure how to describe exactly what I want to do. So I have created the below image to describe what I am trying.

enter image description here

I am lost at how to get the spinner and edittext next to the imageview like I have in the image.

Here is my XML so far.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content">
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <Button android:id="@+id/btnCancel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:text="Cancel"
            />
        <Button android:id="@+id/btnAdd"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:text="Add"
            />
    </RelativeLayout>
    <RelativeLayout>
        <ImageView
            android:id="@+id/imgExercise"
            android:layout_width="50px"
            android:layout_height="50px"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"
            />
        <Spinner 
            android:id="@+id/spCategory"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            />
        <EditText 
            android:id="@+id/etName"
            android:hint="Name"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            />
    </RelativeLayout>
    <EditText 
        android:id="@+id/etDescription"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:lines="5"
        android:gravity="top"
        android:hint="Description"
        />
</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-27T16:40:53+00:00Added an answer on May 27, 2026 at 4:40 pm

    Tips -1:

    First of all, you don’t need to take sub RelativeLayout because you can prepare the same layout in one parent RelativeLayout only. I am coming back with exact answer.

    Tips – 2:

    “px” is not preferable to define measurements, instead you can use dip or dp (density independent pixel) (for height/width of view) and sp(scaled pixel) for Font-size.

    Solution:

    <?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:padding="5dp">
    
            <Button android:id="@+id/btnCancel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:text="Cancel"
                />
            <Button android:id="@+id/btnAdd"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:text="Add"
                />
    
            <ImageView
                android:id="@+id/imgExercise"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:layout_alignParentLeft="true"
                android:layout_below="@+id/btnCancel"
                android:src="@drawable/icon"
                android:scaleType="fitXY"
                />
    
            <Spinner 
                android:id="@+id/spCategory"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/imgExercise"
                android:layout_below="@+id/btnCancel"
                android:layout_alignTop="@+id/imgExercise"
                />
    
            <EditText 
                android:id="@+id/etName"
                android:hint="Name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/imgExercise"
                android:layout_below="@+id/spCategory"
                android:layout_alignBottom="@+id/imgExercise"
                />
    
    
        <EditText 
            android:id="@+id/etDescription"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:lines="5"
            android:gravity="top"
            android:hint="Description"
            android:layout_below="@+id/imgExercise"
            />
    </RelativeLayout>
    

    Output:

    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 trying to create a layout where I have a image and to the
The image below represents a website layout I am trying to create. The blue
I'm trying to create a layout with display: table and alike, but it seems
I am trying to just create a basic layout, but i am having trouble
I am trying to create a simple Icon+Text ListView but it does not work.
I've been trying to create a layout like this: Now I'm not asking for
I am trying to create a new custom module in magento but the layout
I'm trying to develop Apps for Android with ECLIPSE, but I have too many
I am trying to create a layout using a fixed header and sidebar but
I'm just trying to create a simple broadcast in Androids activity but its not

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.