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

The Archive Base Latest Questions

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

I have a spinner which is in the parent layout, which holds the Spinner,

  • 0

I have a spinner which is in the parent layout, which holds the Spinner, and nested Relative layouts. The problem I am having is that I cannot seem to get the Spinner to align to this parent layout, even when I specify to align in parent, it still aligns to a nested view.

To clarify: My Spinner is being aligned to the top left of “relativeone”, not “back_layout”.

Any ideas?

Relevant XML code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/back_layout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#000000"
    android:gravity="center"
    >

    <Spinner
        android:id="@+id/spinner"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:background="#FFFFFF"
        android:entries="@array/spinner"
        android:layout_alignLeft="@+id/relativeone" />

    <RelativeLayout
        android:id="@+id/relativeone"
        android:layout_width="300dp"
        android:layout_height="300dp"
        android:layout_gravity="center" 
        android:gravity="center">

        <RelativeLayout
            android:id="@+id/relativetwo"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="center"
            android:gravity="center" >

            <ImageView
                android:id="@+id/imageview"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true"
                android:layout_gravity="center"
                android:scaleType="fitXY" />

            <Button
                android:id="@+id/buttonone"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true"
                android:text="Take Photo" />
        </RelativeLayout>
    </RelativeLayout>

</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-06-11T03:54:39+00:00Added an answer on June 11, 2026 at 3:54 am

    You need to make some minor changes to your properties to make it work.

    Drop the center align from back_layout, drop the align left from the spinner, and add center in parent to relativeone.

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/back_layout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#000000" >
        <Spinner
            android:id="@+id/spinner1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true" />
        <RelativeLayout
            android:id="@+id/relativeone"
            android:layout_width="300dp"
            android:layout_height="300dp"
            android:layout_centerInParent="true"
            android:layout_gravity="center"
            android:gravity="center" >
            <RelativeLayout
                android:id="@+id/relativetwo"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_gravity="center"
                android:gravity="center" >
                <ImageView
                    android:id="@+id/imageview"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentTop="true"
                    android:layout_gravity="center"
                    android:scaleType="fitXY" />
                <Button
                    android:id="@+id/buttonone"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:layout_centerHorizontal="true"
                    android:text="Take Photo" />
            </RelativeLayout>
        </RelativeLayout>
    </RelativeLayout>
    

    Tha above layout will give you this:

    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 have a spinner which is populated with Category objects that are retrieved from
I want to implement the below: A spinner which would have a custom layout,
Hi I have a spinner for which I would like to change its entry.
I have created an application for ContactsContract... I have created a spinner which brings
I have an activity with a spinner which loads a simpleCursorAdaptor. I call another
I have one spinner, and I am populating that. I have list of values
Hi I have a spinner (spinner5) and whenever the user selects an item that
I have a spinner, which mostly works. If a user selects one of the
I'd really like my app to have a Spinner which stretches the entire length
I have a spinner which is in the Emulator light gray with black text

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.