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:

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