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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:43:34+00:00 2026-05-28T03:43:34+00:00

I’m trying to create a ViewFlipper where each child View has some minimum size

  • 0

I’m trying to create a ViewFlipper where each child View has some minimum size (based on their contents) but each should fill the outer ViewFlipper. So I thought if I make the size of each child FILL_PARENT, it’ll do exactly what I’d like.

However, it seems what happens is the size of each child is calculated individually, then the maximum is taken and that’s what the size of the ViewFlipper is, but the layout of the children is not re-calculated to match this new size. The weird thing is, this seems to happen only if FEATURE_NO_TITLE is set.

Below is a demonstration of the problem. Child 0 is sized FILL_PARENT x FILL_PARENT, and child 1 is 100x100, so the size of the ViewFlipper is correctly determined to be 100x100. However, child 0 is not resized to be 100x100; in fact, it has size 0x0 (as you can tell when running the app and seeing the red rectangle with no trace of green on it). However, if you remove the line

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

then it works as expected…
What’s going on here?

The code:

package com.example.flipper;

import android.app.Activity;
import android.os.Bundle;
import android.view.*;
import android.widget.*;

public class MainActivity extends Activity
{
    ViewFlipper flipper;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        this.requestWindowFeature(Window.FEATURE_NO_TITLE);

        this.flipper = new ViewFlipper(this);
        flipper.setBackgroundColor(0xffff0000);

        {
            LinearLayout ll = new LinearLayout(this);
            ll.setBackgroundColor(0xff00ff00);
            flipper.addView (ll, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
        }

        {
            LinearLayout ll = new LinearLayout(this);
            ll.setBackgroundColor(0xff0000ff);
            flipper.addView (ll, new ViewGroup.LayoutParams(100, 100));
        }

        setContentView(flipper);
    }

    @Override
    public boolean onTouchEvent(MotionEvent e)
    {
        flipper.setDisplayedChild(1);
        return true;
    }
}

the manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.flipper"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:label="@string/app_name" >
        <activity android:name="MainActivity"
                  android:theme="@android:style/Theme.Dialog"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest> 
  • 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-28T03:43:35+00:00Added an answer on May 28, 2026 at 3:43 am

    It seems I was able to solve this with a kludge: I wrapped the ViewFlipper in a LinearLayout and set that as the activity’s view:

    LinearLayout llOuter = new LinearLayout(this);
    llOuter.addView(flipper, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
    
    setContentView(llOuter);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I want to count how many characters a certain string has in PHP, but
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace

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.