Google I/O 2011のioschedアプリをいじっています。ScheduleFragment を見て、ワークスペースの子でページを前後に移動する別のビューをテストしています。ただし、子ビューで親を埋めるのに問題があります。いくつかの背景色とパディングを追加して、すべてがどこに配置されているかを示しました。これが私のテストです...
このようにfragment_schedule.xmlの「Workspace」項目に赤い背景色を追加した...
android:background="#cc0000"
次に、子ビューに blocks_content.xml を使用する代わりに、私は独自の pending_content.xml を作成しました。これは、単純な緑の背景の LinearLayout (高さの fill_parent を使用) と青の背景の TextView (高さの fill_parent を使用) です。テキスト行。
<?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/O アプリに「日」があるように、ビューを追加します...
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);
デバイスで表示すると、次のように表示されます。
赤のワークスペースが使用可能な親スペースを埋めていることがわかりますが、緑の LinearLayout はそうではありません。私は何が欠けていますか?