Show use of include tag in percent layouts.
Change-Id: I041cacb09232274267a319ab17a338980aab6cfb
diff --git a/samples/SupportPercentDemos/res/layout/demo_3.xml b/samples/SupportPercentDemos/res/layout/demo_3.xml
new file mode 100644
index 0000000..1024446
--- /dev/null
+++ b/samples/SupportPercentDemos/res/layout/demo_3.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<android.support.percent.PercentFrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ >
+ <include layout="@layout/demo_include" />
+</android.support.percent.PercentFrameLayout>
diff --git a/samples/SupportPercentDemos/res/layout/demo_include.xml b/samples/SupportPercentDemos/res/layout/demo_include.xml
new file mode 100644
index 0000000..5ad98df
--- /dev/null
+++ b/samples/SupportPercentDemos/res/layout/demo_include.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<merge
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ >
+ <View
+ app:layout_widthPercent="60%"
+ app:layout_heightPercent="60%"
+ app:layout_marginTopPercent="20%"
+ app:layout_marginLeftPercent="20%"
+ android:background="#FF0000"
+ />
+ <View
+ android:layout_gravity="bottom|right"
+ app:layout_widthPercent="20%"
+ app:layout_heightPercent="20%"
+ app:layout_marginRightPercent="40%"
+ app:layout_marginBottomPercent="40%"
+ android:background="#0000FF"
+ />
+</merge>
diff --git a/samples/SupportPercentDemos/src/com/example/android/support/percent/SupportPercentDemos.java b/samples/SupportPercentDemos/src/com/example/android/support/percent/SupportPercentDemos.java
index 0290eb3..db92f84 100644
--- a/samples/SupportPercentDemos/src/com/example/android/support/percent/SupportPercentDemos.java
+++ b/samples/SupportPercentDemos/src/com/example/android/support/percent/SupportPercentDemos.java
@@ -44,6 +44,7 @@
super(fm);
}
+
@Override
public Fragment getItem(int position) {
PercentFragment fragment = new PercentFragment();
@@ -54,6 +55,10 @@
break;
case 1:
args.putInt(LAYOUT_RESOURCE_ID, R.layout.demo_2);
+ break;
+ case 2:
+ args.putInt(LAYOUT_RESOURCE_ID, R.layout.demo_3);
+ break;
default:
break;
}
@@ -63,7 +68,7 @@
@Override
public int getCount() {
- return 2;
+ return 3;
}
}