Playback "Workspace" does not fill the height of the Google application "iosched"

I play with the iosched application from Google I / O 2011. Looking at ScheduleFragment, I am testing a different view of Workspace child elements for page turning back and forth. However, I am having trouble getting my child views to populate the parent. I added some background colors and some additions to show where everything is laid out. Here is my test ...

I added a red background color to the "Workspace" element in fragment_schedule.xml, like this ...

android:background="#cc0000"

Then instead of using blocks_content.xml for the child view, I created my own pending_content.xml, which is just a LinearLayout with a green background (with fill_parent for height) and a blue TextView background (also with fill_parent for height) with a simple text string.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/container"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#00cc00"
    android:padding="5dip"
    xmlns:android="http://schemas.android.com/apk/res/android">
        <TextView
        android:id="@+id/text_view"
        android:background="#0000cc"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:text="Pending Content"
        android:textColor="#ffffff"
        />
</LinearLayout>

I add my view in the same way that an I / O application has "days" ...

ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_schedule, null);
mWorkspace = (Workspace) root.findViewById(R.id.workspace);

ShootView view = new ShootView();
view.index = mViews.size();
view.rootView = (ViewGroup) inflater.inflate(R.layout.pending_content, null);
view.label = "Pending";
mWorkspace.addView(view.rootView);
mViews.add(view);

And this is what I see when I view it on the device:

http://www.milescrew.com/images/workspace.png

You will see that the red workspace fills the available parent space, but the green LinearLayout does not. What am I missing?

+3
source share
2 answers

. onLayout Workspace.java. child.layout child.getMeasuredHeight() this.getMeasuredHeight(), .

, , , ( ListView), .

0

, :

view.rootView = (ViewGroup) inflater.inflate(R.layout.pending_content, null);

LayoutParams, XML, .

, root :

view.rootView = (ViewGroup) inflater.inflate(R.layout.pending_content, mWorkspace, false);

LayoutParams XML-.

+3

All Articles