Jump to content
Android Forum - A Community For Android Users and Enthusiasts

FrameLayout in ViewSwitcher doesn't resize!


D_Ponsford
 Share

Recommended Posts

Hi All, I have a problem with a FrameLayout inside a LinearLayout/ViewSwitcher which has been dogging me for days! Any help would be appreciated:

 

In the XML, I have a LinearLayout that defines a background theme, a ViewSwitcher inside that, and a LinearLayout in the first (upper) half of the ViewSwitcher. The upper half of the ViewSwitcher has several TextViews and a FrameLayout which places the frame in the bottom-right-hand corner of the screen. I insert a live image from the camera into that FrameLayout. So far, so good!

 

The 2nd half of the ViewSwitcher only has a single FrameLayout in it, in which I also insert the live camera view. I want this 2nd FrameLayout to fill the screen inside the background - but it doesn't.

 

The first screen and the swiping between the 2 switchable views works OK, but I can't get the single FrameLayout in the 2nd screen to fill the view (the background theme has a full-width button at the top and bottom - this displays OK). The 2nd switched view still has the small video frame in it. I've tried everything I can think of and searched what feels like every single relevant post on teh forum, but I can't get the 2nd FrameLayout to fill the screen.

 

I've tried putting the 2nd FrameLayout inside it's own LinearLayout, but to no avail.

If I move the single FrameLayout to the upper half of the ViewSwitcher (so that it appears first on onCreate), then I get the full-screen video image that I want, but then switching to the 2nd view gives me no video frame at all (but all the text views are there)!

 

Setting android:measureAllChildren="false" in the XML and switcher.setMeasureAllChildren(false); in the code makes no difference.

 

Here's the XML...

 

style="@style/background"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical" >

android:id="@+id/viewswitcher"

android:layout_width="fill_parent"

android:layout_height="0dp"

android:measureAllChildren="false"

android:layout_weight="1" >

***************

V I E W O N E

***************

-->

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_marginLeft="1sp"

android:orientation="horizontal" >

android:layout_width="wrap_content"

android:layout_height="match_parent"

android:layout_marginRight="5sp"

android:orientation="vertical" >

android:id="@+id/txt1"

style="@style/normaltext"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_margin="1sp"

android:text="@string/str1" />

....

....

android:id="@+id/txt3"

style="@style/normaltext"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_margin="1sp"

android:text="@string/str2" />

android:layout_width="100dp"

android:layout_height="wrap_content"

android:layout_marginLeft="1sp"

android:layout_marginRight="1sp"

android:layout_weight="0.38"

android:orientation="vertical" >

android:id="@+id/txt4"

style="@style/normaltext"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginTop="1sp" />

....

....

android:id="@+id/txt5"

style="@style/normaltext"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginTop="1sp"

android:text="@string/str3" />

android:layout_width="match_parent"

android:layout_height="match_parent" >

android:id="@+id/camimage"

android:layout_width="match_parent"

android:layout_height="wrap_content" >

***************

V I E W T W O

***************

-->

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:measureAllChildren="false"

android:layout_weight="1" >

android:id="@id/camimage"

android:layout_width="wrap_content"

android:layout_height="wrap_content" >

 

I'm sure it's just a case of the Switcher taking the size of the first FrameLayout instance it sees and then it's stuck with that for both views, but I can't find a way to get it to resize the FrameLayout to fill the screen on the 2nd view.

Can anybody help with this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...