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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:32:29+00:00 2026-05-19T13:32:29+00:00

I already spent hours on this, its a layout issue. can someone tell me

  • 0

I already spent hours on this, its a layout issue. can someone tell me how to show both image and view switcher in the same activity.

<RelativeLayout 
            xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:myapp="http://schemas.android.com/apk/res/rg.client.muscle"
            android:layout_width="fill_parent"
        android:layout_height="fil_parent">
    <ViewSwitcher 
        android:id="@+id/relative"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:layout_alignParentBottom="true">

        <!-- contains two relative layouts of same sizes 
        containing same elements just with switched positions -->

        <RelativeLayout 

            android:layout_width="fill_parent"
            android:layout_height="wrap_content" 
            android:layout_alignParentBottom="true" >

            <com.admob.android.ads.AdView 
                android:id="@+id/adv" 
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                myapp:backgroundColor="#000000" 
                myapp:primaryTextColor="#FFFFFF" 
                myapp:secondaryTextColor="#CCCCCC"
                myapp:refreshInterval="30" >
            </com.admob.android.ads.AdView>

            <LinearLayout 
                android:id="@+id/linear" 
                android:orientation="horizontal" 
                android:weightSum="100" 
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content" 
                android:layout_above="@id/adv" >

                <Button 
                    android:id="@+id/but_prev2" 
                    android:text="Previous" 
                    android:layout_width="0dp" 
                    android:layout_height="wrap_content" 
                    android:layout_weight="30" >
                </Button>

                <Button 
                    android:id="@+id/but_more2" 
                    android:text="More" 
                    android:layout_width="0dp" 
                    android:layout_height="wrap_content" 
                    android:layout_weight="40" >
                </Button>

                <Button 
                    android:id="@+id/but_next2" 
                    android:text="Next" 
                    android:layout_width="0dp" 
                    android:layout_height="wrap_content" 
                    android:layout_weight="30">
                </Button>
            </LinearLayout>
        </RelativeLayout>

        <RelativeLayout 

            android:layout_width="fill_parent"
            android:layout_height="wrap_content" 
            android:layout_alignParentBottom="true" >

            <LinearLayout 
                android:id="@+id/linear2" 
                android:orientation="horizontal"  
                android:weightSum="100" 
                android:layout_width="fill_parent"    
                android:layout_height="wrap_content" 
                android:layout_alignParentBottom="true" >

                <Button 
                    android:id="@+id/but_prev" 
                    android:text="Previous" 
                    android:layout_width="0dp" 
                    android:layout_height="wrap_content" 
                    android:layout_weight="30">
                </Button>

                <Button 
                    android:id="@+id/but_more" 
                    android:text="More" 
                    android:layout_width="0dp" 
                    android:layout_height="wrap_content" 
                    android:layout_weight="40">
                </Button>

                <Button 
                    android:id="@+id/but_next" 
                    android:text="Next" 
                    android:layout_width="0dp"   
                    android:layout_height="wrap_content" 
                    android:layout_weight="30">
                </Button>

            </LinearLayout>

            <com.admob.android.ads.AdView 
                android:id="@+id/adv2" 
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content"
                android:layout_above="@id/linear2" 
                myapp:backgroundColor="#000000" 
                myapp:primaryTextColor="#FFFFFF" 
                myapp:secondaryTextColor="#CCCCCC"
                myapp:refreshInterval="30">
            </com.admob.android.ads.AdView>
        </RelativeLayout>
    </ViewSwitcher>

    <ImageView 
        android:id="@+id/image"
        android:layout_above="@id/relative"
        android:padding="2pt" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignParentTop="true" >
    </ImageView>
</RelativeLayout>

If I put the imageview first then each time a new image is loaded the buttons disappear and the whole layout seems to be re inflated

Update:

The layout must have an image view at the top then a view switcher.

  • 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-19T13:32:29+00:00Added an answer on May 19, 2026 at 1:32 pm

    I imagine a lot of it has to do with you not being able to read your XML. If it looks anything like the way you originally pasted it in here, that is. Your first problem is that you have nothing in your root RelativeLayout tag specifying a size. Your root layout should be in most cases set to a layout_width of fill_parent, same with the layout_height. You also need your schema specification (i.e. xmlns:android="http://schemas.android.com/apk/res/android" although I’m assuming you just left that out, since you’re actually getting it to compile.

    You also may want to keep in mind, since most everything is set to wrap_content for height, if it ever exceeds the height of the screen, some of it will not be visible, so you may consider wrapping the inner portion into a ScrollView.

    EDIT: Again, I’d suggest setting your RelativeLayout (root element) to have a height of fill_parent. Try defining your ImageView first, leaving it with alignParentTop="true", then define your ViewSwitcher, and give it the layout_below="@id/image" attribute.

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

Sidebar

Related Questions

I hope someone can help me as I've already spent several hours trying to
I've already spent countless hours puzzling over this, utilizing Google searches and other Stack
I have spent 5 hours on this, and I've already been up 30 hours
I've spent over 6 hours on this issue by now and really need help.
If anyone can help me on this I would be very excited...I've already spent
First, forgive me if this has been answered already. I spent a few hours
I already spent hours on this problem, but I didn't succeed in finding a
I have spent hours on this problem, I hope somebody can help me. Sorry
I'v spent already a few hours to figure out this query but no result,
I have a problem with php header redirect. I already spent hours trying to

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.