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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:26:47+00:00 2026-05-23T05:26:47+00:00

i have an activity which has an relative layout. <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=match_parent android:orientation=vertical

  • 0

i have an activity which has an relative layout.

<RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#FFFFFF">



 <TextView android:id="@+id/time_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text = "Name :"
        android:textSize = "14sp"
        android:textColor = "#000000"
        android:textStyle = "bold"
        android:layout_gravity="center_vertical|center_horizontal"
    />

   <Spinner android:id="@+id/spinner_time"
        android:layout_height="40dp" 
        android:layout_width="match_parent" 
            android:prompt="@string/time_list" 
         android:layout_below = "@+id/time_label"
         android:layout_marginLeft = "5dp"
         android:layout_marginRight = "5dp">
   </Spinner>

 <TextView></TextView> 
 <EditText></EditText>
 <ImageButton></ImageButton>

</RelativeLayout>

Now according to user selection from spinner i need to change the layout elements like 2 buttons 3 textview or 4 buttons 1 textview. So for this do i have to take all the elements in the xml layout and use “android:visibility” optional to show according to user selection or there is any other better way to do this cause i am finding this method a bit cluttered.

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-05-23T05:26:48+00:00Added an answer on May 23, 2026 at 5:26 am

    It is the way you are going to use the Android:visibility that can make it easier. What you can do is create multiple linearLayouts for each item in spinner. Mind you I am assuming the number of items in it are static. Name the layouts as layout0, layout1, layout2 … corresponding to each item in the Spinner. Then based on selection for spinner change the visibility.

    The other way is to use layout inflater and populate the view dynamically through code.

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

Sidebar

Related Questions

I have an Android activity which has a header, some title text, and then
In my application i have an activity which has the following layout <?xml version=1.0
I am writing a custom component (derived from a relative layout) which has to
I have a custom activity which has inargument<MyClass>. MyClass has several properties. I want
I have an Android activity which in turn starts a thread. In the thread
I have a layout which has one large EditText view at the top +
I have an Activity named whereActity which has child dialogs as well. Now, I
I have a workflow which has a custom activity which calls a web service.
Here's the scenario I have an activity(A) which has a button and textview. I
I have created an application having tab activity which in turn has 5 different

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.