Merge "Refactor BiDiTest unit tests app"
diff --git a/tests/BiDiTests/AndroidManifest.xml b/tests/BiDiTests/AndroidManifest.xml
index 135c5dd..4a687f2 100644
--- a/tests/BiDiTests/AndroidManifest.xml
+++ b/tests/BiDiTests/AndroidManifest.xml
@@ -29,118 +29,6 @@
             </intent-filter>
         </activity>
 
-        <activity android:name=".BiDiTestBasicActivity"
-                android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BiDiTestCanvasActivity"
-                  android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BiDiTestLinearLayoutLtrActivity"
-                  android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BiDiTestLinearLayoutRtlActivity"
-                  android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BiDiTestLinearLayoutLocaleActivity"
-                  android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BiDiTestFrameLayoutLtrActivity"
-                  android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BiDiTestFrameLayoutRtlActivity"
-                  android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BiDiTestFrameLayoutLocaleActivity"
-                  android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BiDiTestRelativeLayoutLtrActivity"
-                  android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BiDiTestRelativeLayoutRtlActivity"
-                  android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BiDiTestRelativeLayoutLtrActivity2"
-                  android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BiDiTestRelativeLayoutRtlActivity2"
-                  android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BiDiTestRelativeLayoutLocaleActivity2"
-                  android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BiDiTestTableLayoutLtrActivity"
-                  android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BiDiTestTableLayoutRtlActivity"
-                  android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BiDiTestTableLayoutLocaleActivity"
-                  android:windowSoftInputMode="stateAlwaysHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-            </intent-filter>
-        </activity>
-
     </application>
 
 </manifest>
diff --git a/tests/BiDiTests/res/layout/basic.xml b/tests/BiDiTests/res/layout/basic.xml
index d5f5ba7..d438b2c 100644
--- a/tests/BiDiTests/res/layout/basic.xml
+++ b/tests/BiDiTests/res/layout/basic.xml
@@ -14,36 +14,41 @@
      limitations under the License.
 -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:orientation="vertical"
-              android:layout_width="match_parent"
-              android:layout_height="match_parent">
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/basic"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
 
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="vertical"
+    <LinearLayout android:orientation="vertical"
                   android:layout_width="match_parent"
-                  android:layout_height="wrap_content">
+                  android:layout_height="match_parent">
 
-        <Button android:id="@+id/button"
-                android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button_text"
-                android:textSize="32dip"
-                />
+        <LinearLayout android:orientation="vertical"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content">
 
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="32dip"
-                  android:text="@string/textview_text"
-                />
+            <Button android:id="@+id/button"
+                    android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button_text"
+                    android:textSize="32dip"
+                    />
 
-        <EditText android:id="@+id/edittext"
-                  android:layout_height="wrap_content"
-                  android:layout_width="match_parent"
-                  android:textSize="32dip"
-                />
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="32dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <EditText android:id="@+id/edittext"
+                      android:layout_height="wrap_content"
+                      android:layout_width="match_parent"
+                      android:textSize="32dip"
+                    />
+
+        </LinearLayout>
 
     </LinearLayout>
 
-</LinearLayout>
\ No newline at end of file
+</FrameLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/canvas.xml b/tests/BiDiTests/res/layout/canvas.xml
index 03b1bb2..0319a83 100644
--- a/tests/BiDiTests/res/layout/canvas.xml
+++ b/tests/BiDiTests/res/layout/canvas.xml
@@ -14,21 +14,27 @@
      limitations under the License.
 -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:orientation="vertical"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/canvas"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
+
+    <LinearLayout android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="match_parent">
+
+        <SeekBar android:id="@+id/seekbar"
+                 android:layout_height="wrap_content"
+                 android:layout_width="match_parent"
+                />
+
+        <view class="com.android.bidi.BiDiTestView"
+              android:id="@+id/testview"
               android:layout_width="match_parent"
-              android:layout_height="match_parent">
+              android:layout_height="wrap_content"
+              android:background="#FF0000"
+                />
 
-    <SeekBar android:id="@+id/seekbar"
-             android:layout_height="wrap_content"
-             android:layout_width="match_parent"
-            />
+    </LinearLayout>
 
-    <view class="com.android.bidi.BiDiTestView"
-          android:id="@+id/testview"
-          android:layout_width="match_parent"
-          android:layout_height="wrap_content"
-          android:background="#FF0000"
-            />
-
-</LinearLayout>
+</FrameLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/custom_list_item.xml b/tests/BiDiTests/res/layout/custom_list_item.xml
new file mode 100644
index 0000000..069424e
--- /dev/null
+++ b/tests/BiDiTests/res/layout/custom_list_item.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2006 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.
+-->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@android:id/text1"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:textAppearance="?android:attr/textAppearanceLarge"
+    android:gravity="center_vertical"
+    android:paddingLeft="6dip"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:background="?android:attr/activatedBackgroundIndicator"
+/>
diff --git a/tests/BiDiTests/res/layout/frame_layout_locale.xml b/tests/BiDiTests/res/layout/frame_layout_locale.xml
index 812e0dc..3382234 100644
--- a/tests/BiDiTests/res/layout/frame_layout_locale.xml
+++ b/tests/BiDiTests/res/layout/frame_layout_locale.xml
@@ -15,74 +15,78 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-             android:id="@+id/frame_layout_ltr"
-             android:layout_width="match_parent"
-             android:layout_height="match_parent"
-             android:layoutDirection="locale"
-             android:background="#FF000000">
+        android:id="@+id/frame_layout_locale"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="right|center_vertical"
-            android:background="#FFFF0000">
-    </FrameLayout>
+    <FrameLayout android:layout_width="match_parent"
+                 android:layout_height="match_parent"
+                 android:layoutDirection="locale"
+                 android:background="#FF000000">
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="left|center_vertical"
-            android:background="#FF00FF00">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="right|center_vertical"
+                android:background="#FFFF0000">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="top|center_horizontal"
-            android:background="#FF0000FF">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="left|center_vertical"
+                android:background="#FF00FF00">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="bottom|center_horizontal"
-            android:background="#FF00FFFF">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="top|center_horizontal"
+                android:background="#FF0000FF">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="top|start"
-            android:background="#FFFFFFFF">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="bottom|center_horizontal"
+                android:background="#FF00FFFF">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="top|end"
-            android:background="#FFFFFF00">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="top|start"
+                android:background="#FFFFFFFF">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="bottom|start"
-            android:background="#FFFFFFFF">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="top|end"
+                android:background="#FFFFFF00">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="bottom|end"
-            android:background="#FFFFFF00">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="bottom|start"
+                android:background="#FFFFFFFF">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="center_horizontal|center_vertical"
-            android:background="#FF888888">
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="bottom|end"
+                android:background="#FFFFFF00">
+        </FrameLayout>
+
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="center_horizontal|center_vertical"
+                android:background="#FF888888">
+        </FrameLayout>
+
     </FrameLayout>
 
 </FrameLayout>
-
diff --git a/tests/BiDiTests/res/layout/frame_layout_ltr.xml b/tests/BiDiTests/res/layout/frame_layout_ltr.xml
index 79effe6..a8ae9144 100644
--- a/tests/BiDiTests/res/layout/frame_layout_ltr.xml
+++ b/tests/BiDiTests/res/layout/frame_layout_ltr.xml
@@ -15,74 +15,78 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-             android:id="@+id/frame_layout_ltr"
-             android:layout_width="match_parent"
-             android:layout_height="match_parent"
-             android:layoutDirection="ltr"
-             android:background="#FF000000">
+        android:id="@+id/frame_layout_ltr"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="right|center_vertical"
-            android:background="#FFFF0000">
-    </FrameLayout>
+    <FrameLayout android:layout_width="match_parent"
+                 android:layout_height="match_parent"
+                 android:layoutDirection="ltr"
+                 android:background="#FF000000">
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="left|center_vertical"
-            android:background="#FF00FF00">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="right|center_vertical"
+                android:background="#FFFF0000">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="top|center_horizontal"
-            android:background="#FF0000FF">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="left|center_vertical"
+                android:background="#FF00FF00">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="bottom|center_horizontal"
-            android:background="#FF00FFFF">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="top|center_horizontal"
+                android:background="#FF0000FF">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="top|start"
-            android:background="#FFFFFFFF">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="bottom|center_horizontal"
+                android:background="#FF00FFFF">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="top|end"
-            android:background="#FFFFFF00">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="top|start"
+                android:background="#FFFFFFFF">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="bottom|start"
-            android:background="#FFFFFFFF">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="top|end"
+                android:background="#FFFFFF00">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="bottom|end"
-            android:background="#FFFFFF00">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="bottom|start"
+                android:background="#FFFFFFFF">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="center_horizontal|center_vertical"
-            android:background="#FF888888">
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="bottom|end"
+                android:background="#FFFFFF00">
+        </FrameLayout>
+
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="center_horizontal|center_vertical"
+                android:background="#FF888888">
+        </FrameLayout>
+
     </FrameLayout>
 
 </FrameLayout>
-
diff --git a/tests/BiDiTests/res/layout/frame_layout_rtl.xml b/tests/BiDiTests/res/layout/frame_layout_rtl.xml
index a793862..258d44a 100644
--- a/tests/BiDiTests/res/layout/frame_layout_rtl.xml
+++ b/tests/BiDiTests/res/layout/frame_layout_rtl.xml
@@ -15,74 +15,78 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-             android:id="@+id/frame_layout_ltr"
-             android:layout_width="match_parent"
-             android:layout_height="match_parent"
-             android:layoutDirection="rtl"
-             android:background="#FF000000">
+        android:id="@+id/frame_layout_rtl"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="right|center_vertical"
-            android:background="#FFFF0000">
-    </FrameLayout>
+    <FrameLayout android:layout_width="match_parent"
+                 android:layout_height="match_parent"
+                 android:layoutDirection="ltr"
+                 android:background="#FF000000">
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="left|center_vertical"
-            android:background="#FF00FF00">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="right|center_vertical"
+                android:background="#FFFF0000">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="top|center_horizontal"
-            android:background="#FF0000FF">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="left|center_vertical"
+                android:background="#FF00FF00">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="bottom|center_horizontal"
-            android:background="#FF00FFFF">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="top|center_horizontal"
+                android:background="#FF0000FF">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="top|start"
-            android:background="#FFFFFFFF">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="bottom|center_horizontal"
+                android:background="#FF00FFFF">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="top|end"
-            android:background="#FFFFFF00">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="top|start"
+                android:background="#FFFFFFFF">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="bottom|start"
-            android:background="#FFFFFFFF">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="top|end"
+                android:background="#FFFFFF00">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="bottom|end"
-            android:background="#FFFFFF00">
-    </FrameLayout>
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="bottom|start"
+                android:background="#FFFFFFFF">
+        </FrameLayout>
 
-    <FrameLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="center_horizontal|center_vertical"
-            android:background="#FF888888">
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="bottom|end"
+                android:background="#FFFFFF00">
+        </FrameLayout>
+
+        <FrameLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="center_horizontal|center_vertical"
+                android:background="#FF888888">
+        </FrameLayout>
+
     </FrameLayout>
 
 </FrameLayout>
-
diff --git a/tests/BiDiTests/res/layout/linear_layout_locale.xml b/tests/BiDiTests/res/layout/linear_layout_locale.xml
index 72046cb..bddb458 100644
--- a/tests/BiDiTests/res/layout/linear_layout_locale.xml
+++ b/tests/BiDiTests/res/layout/linear_layout_locale.xml
@@ -14,244 +14,240 @@
      limitations under the License.
 -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/linear_layout_rtl"
-              android:orientation="vertical"
-              android:layout_width="match_parent"
-              android:layout_height="match_parent"
-              android:layoutDirection="locale">
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/linear_layout_locale"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
+        
+    <LinearLayout android:orientation="vertical"
                   android:layout_width="match_parent"
-                  android:layout_height="wrap_content">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="inherit">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="ltr">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="rtl">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
+                  android:layout_height="match_parent"
                   android:layoutDirection="locale">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
+    
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="inherit">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="ltr">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="rtl">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="locale">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="vertical"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="inherit">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="vertical"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="ltr">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="vertical"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="rtl">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="vertical"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="locale">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
     </LinearLayout>
 
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="vertical"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="inherit">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="vertical"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="ltr">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="vertical"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="rtl">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="vertical"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="locale">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-</LinearLayout>
\ No newline at end of file
+</FrameLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/linear_layout_ltr.xml b/tests/BiDiTests/res/layout/linear_layout_ltr.xml
index bea087e..060112d 100644
--- a/tests/BiDiTests/res/layout/linear_layout_ltr.xml
+++ b/tests/BiDiTests/res/layout/linear_layout_ltr.xml
@@ -14,244 +14,240 @@
      limitations under the License.
 -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/linear_layout_ltr"
-              android:orientation="vertical"
-              android:layout_width="match_parent"
-              android:layout_height="match_parent"
-              android:layoutDirection="ltr">
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/linear_layout_ltr"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
+        
+    <LinearLayout android:orientation="vertical"
                   android:layout_width="match_parent"
-                  android:layout_height="wrap_content">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="inherit">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
+                  android:layout_height="match_parent"
                   android:layoutDirection="ltr">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
+    
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="inherit">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="ltr">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="rtl">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="locale">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="vertical"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="inherit">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="vertical"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="ltr">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="vertical"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="rtl">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="vertical"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="locale">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
     </LinearLayout>
 
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="rtl">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="locale">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="vertical"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="inherit">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="vertical"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="ltr">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="vertical"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="rtl">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="vertical"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="locale">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-</LinearLayout>
\ No newline at end of file
+</FrameLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/linear_layout_rtl.xml b/tests/BiDiTests/res/layout/linear_layout_rtl.xml
index 12f14ef..53ecbcc 100644
--- a/tests/BiDiTests/res/layout/linear_layout_rtl.xml
+++ b/tests/BiDiTests/res/layout/linear_layout_rtl.xml
@@ -14,244 +14,240 @@
      limitations under the License.
 -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/linear_layout_rtl"
-              android:orientation="vertical"
-              android:layout_width="match_parent"
-              android:layout_height="match_parent"
-              android:layoutDirection="rtl">
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/linear_layout_rtl"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
+        
+    <LinearLayout android:orientation="vertical"
                   android:layout_width="match_parent"
-                  android:layout_height="wrap_content">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="inherit">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="ltr">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
+                  android:layout_height="match_parent"
                   android:layoutDirection="rtl">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
+    
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="inherit">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="ltr">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="rtl">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="horizontal"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="locale">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="vertical"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="inherit">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="vertical"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="ltr">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="vertical"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="rtl">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
+        <LinearLayout android:orientation="vertical"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:layoutDirection="locale">
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button1_text"
+                    android:textSize="24dip"
+                    />
+    
+            <TextView android:id="@+id/textview"
+                      android:layout_height="wrap_content"
+                      android:layout_width="wrap_content"
+                      android:textSize="24dip"
+                      android:text="@string/textview_text"
+                    />
+    
+            <Button android:layout_height="wrap_content"
+                    android:layout_width="wrap_content"
+                    android:text="@string/button2_text"
+                    android:textSize="24dip"
+                    />
+        </LinearLayout>
+    
     </LinearLayout>
 
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="horizontal"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="locale">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="vertical"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="inherit">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="vertical"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="ltr">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="vertical"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="rtl">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                  android:orientation="vertical"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:layoutDirection="locale">
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button1_text"
-                android:textSize="24dip"
-                />
-
-        <TextView android:id="@+id/textview"
-                  android:layout_height="wrap_content"
-                  android:layout_width="wrap_content"
-                  android:textSize="24dip"
-                  android:text="@string/textview_text"
-                />
-
-        <Button android:layout_height="wrap_content"
-                android:layout_width="wrap_content"
-                android:text="@string/button2_text"
-                android:textSize="24dip"
-                />
-    </LinearLayout>
-
-</LinearLayout>
\ No newline at end of file
+</FrameLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/main.xml b/tests/BiDiTests/res/layout/main.xml
index eb73d44..3543eb7 100644
--- a/tests/BiDiTests/res/layout/main.xml
+++ b/tests/BiDiTests/res/layout/main.xml
@@ -14,28 +14,20 @@
      limitations under the License.
 -->
 
-<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
-         android:id="@android:id/tabhost"
-         android:layout_width="fill_parent"
-         android:layout_height="fill_parent">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="horizontal"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
 
-    <LinearLayout
-            android:orientation="vertical"
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
-            android:padding="5dp">
+    <ListView android:id="@+id/testlist"
+        android:layout_width="0px" 
+        android:layout_height="fill_parent"
+        android:layout_weight="1"/>
 
-        <TabWidget
-                android:id="@android:id/tabs"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"/>
+    <FrameLayout android:id="@+id/testframe"
+        android:layout_width="0px" 
+        android:layout_height="fill_parent"
+        android:layout_weight="6">
+    </FrameLayout>
 
-        <FrameLayout
-                android:id="@android:id/tabcontent"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent"
-                android:padding="5dp"/>
-
-    </LinearLayout>
-
-</TabHost>
+</LinearLayout>
diff --git a/tests/BiDiTests/res/layout/relative_layout_2_locale.xml b/tests/BiDiTests/res/layout/relative_layout_2_locale.xml
index c99a99b..ff5bf7b 100644
--- a/tests/BiDiTests/res/layout/relative_layout_2_locale.xml
+++ b/tests/BiDiTests/res/layout/relative_layout_2_locale.xml
@@ -14,170 +14,170 @@
      limitations under the License.
 -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/relative_layout_ltr"
-              android:orientation="vertical"
-              android:layout_width="match_parent"
-              android:layout_height="match_parent"
-              android:layoutDirection="locale">
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/relative_layout_2_locale"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
 
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="fill_parent"
+    <LinearLayout android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="match_parent"
+                  android:layoutDirection="locale">
+
+        <RelativeLayout android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:background="#FF000000"
+                        android:padding="10px">
+
+            <TextView android:id="@+id/label_1"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:text="Type here:"/>
+
+            <EditText android:id="@+id/entry_1"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_below="@id/label_1"/>
+
+            <Button android:id="@+id/ok_1"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="#FF000000"
-                    android:padding="10px">
+                    android:layout_below="@id/entry_1"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10px"
+                    android:text="OK"/>
 
-        <TextView android:id="@+id/label_1"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:text="Type here:"/>
-
-        <EditText android:id="@+id/entry_1"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/label_1"/>
-
-        <Button android:id="@+id/ok_1"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_1"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK"/>
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_1"
-                android:layout_alignTop="@id/ok_1"
-                android:text="Cancel"/>
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="fill_parent"
+            <Button android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="#FF000000"
-                    android:padding="10px"
-                    android:layoutDirection="ltr">
+                    android:layout_toLeftOf="@id/ok_1"
+                    android:layout_alignTop="@id/ok_1"
+                    android:text="Cancel"/>
+        </RelativeLayout>
 
-        <TextView android:id="@+id/label_2"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:text="Type here:"/>
+        <RelativeLayout android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:background="#FF000000"
+                        android:padding="10px"
+                        android:layoutDirection="ltr">
 
-        <EditText android:id="@+id/entry_2"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/label_2"/>
+            <TextView android:id="@+id/label_2"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:text="Type here:"/>
 
-        <Button android:id="@+id/ok_2"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_2"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK"/>
+            <EditText android:id="@+id/entry_2"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_below="@id/label_2"/>
 
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_2"
-                android:layout_alignTop="@id/ok_2"
-                android:text="Cancel"/>
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="fill_parent"
+            <Button android:id="@+id/ok_2"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="#FF000000"
-                    android:padding="10px"
-                    android:layoutDirection="inherit">
+                    android:layout_below="@id/entry_2"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10px"
+                    android:text="OK"/>
 
-        <TextView android:id="@+id/label_3"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:text="Type here:"/>
-
-        <EditText android:id="@+id/entry_3"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/label_3"/>
-
-        <Button android:id="@+id/ok_3"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_3"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK"/>
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_3"
-                android:layout_alignTop="@id/ok_3"
-                android:text="Cancel"/>
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="fill_parent"
+            <Button android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="#FF000000"
-                    android:padding="10px"
-                    android:layoutDirection="rtl">
+                    android:layout_toLeftOf="@id/ok_2"
+                    android:layout_alignTop="@id/ok_2"
+                    android:text="Cancel"/>
+        </RelativeLayout>
 
-        <TextView android:id="@+id/label_4"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:text="Type here:"/>
-
-        <EditText android:id="@+id/entry_4"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/label_4"/>
-
-        <Button android:id="@+id/ok_4"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_4"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK"/>
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_4"
-                android:layout_alignTop="@id/ok_4"
-                android:text="Cancel"/>
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="fill_parent"
+        <RelativeLayout android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:background="#FF000000"
+                        android:padding="10px"
+                        android:layoutDirection="inherit">
+    
+            <TextView android:id="@+id/label_3"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:text="Type here:"/>
+    
+            <EditText android:id="@+id/entry_3"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_below="@id/label_3"/>
+    
+            <Button android:id="@+id/ok_3"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="#FF000000"
-                    android:padding="10px"
-                    android:layoutDirection="locale">
+                    android:layout_below="@id/entry_3"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10px"
+                    android:text="OK"/>
+    
+            <Button android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_toLeftOf="@id/ok_3"
+                    android:layout_alignTop="@id/ok_3"
+                    android:text="Cancel"/>
+        </RelativeLayout>
 
-        <TextView android:id="@+id/label_4"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:text="Type here:"/>
+        <RelativeLayout android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:background="#FF000000"
+                        android:padding="10px"
+                        android:layoutDirection="rtl">
 
-        <EditText android:id="@+id/entry_4"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/label_4"/>
+            <TextView android:id="@+id/label_4"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:text="Type here:"/>
 
-        <Button android:id="@+id/ok_4"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_4"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK"/>
+            <EditText android:id="@+id/entry_4"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_below="@id/label_4"/>
 
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_4"
-                android:layout_alignTop="@id/ok_4"
-                android:text="Cancel"/>
-    </RelativeLayout>
+            <Button android:id="@+id/ok_4"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_below="@id/entry_4"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10px"
+                    android:text="OK"/>
 
-</LinearLayout>
\ No newline at end of file
+            <Button android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_toLeftOf="@id/ok_4"
+                    android:layout_alignTop="@id/ok_4"
+                    android:text="Cancel"/>
+        </RelativeLayout>
+
+        <RelativeLayout android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:background="#FF000000"
+                        android:padding="10px"
+                        android:layoutDirection="locale">
+    
+            <TextView android:id="@+id/label_4"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:text="Type here:"/>
+    
+            <EditText android:id="@+id/entry_4"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_below="@id/label_4"/>
+
+            <Button android:id="@+id/ok_4"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_below="@id/entry_4"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10px"
+                    android:text="OK"/>
+    
+            <Button android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_toLeftOf="@id/ok_4"
+                    android:layout_alignTop="@id/ok_4"
+                    android:text="Cancel"/>
+        </RelativeLayout>
+
+    </LinearLayout>
+
+</FrameLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/relative_layout_2_ltr.xml b/tests/BiDiTests/res/layout/relative_layout_2_ltr.xml
index c4cab11..cf585b5 100644
--- a/tests/BiDiTests/res/layout/relative_layout_2_ltr.xml
+++ b/tests/BiDiTests/res/layout/relative_layout_2_ltr.xml
@@ -14,170 +14,170 @@
      limitations under the License.
 -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/relative_layout_ltr"
-              android:orientation="vertical"
-              android:layout_width="match_parent"
-              android:layout_height="match_parent"
-              android:layoutDirection="ltr">
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/relative_layout_2_ltr"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
 
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="fill_parent"
+    <LinearLayout android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="match_parent"
+                  android:layoutDirection="ltr">
+
+        <RelativeLayout android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:background="#FF000000"
+                        android:padding="10px">
+
+            <TextView android:id="@+id/label_1"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:text="Type here:"/>
+
+            <EditText android:id="@+id/entry_1"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_below="@id/label_1"/>
+
+            <Button android:id="@+id/ok_1"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="#FF000000"
-                    android:padding="10px">
+                    android:layout_below="@id/entry_1"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10px"
+                    android:text="OK"/>
 
-        <TextView android:id="@+id/label_1"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:text="Type here:"/>
-
-        <EditText android:id="@+id/entry_1"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/label_1"/>
-
-        <Button android:id="@+id/ok_1"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_1"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK"/>
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_1"
-                android:layout_alignTop="@id/ok_1"
-                android:text="Cancel"/>
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="fill_parent"
+            <Button android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="#FF000000"
-                    android:padding="10px"
-                    android:layoutDirection="ltr">
+                    android:layout_toLeftOf="@id/ok_1"
+                    android:layout_alignTop="@id/ok_1"
+                    android:text="Cancel"/>
+        </RelativeLayout>
 
-        <TextView android:id="@+id/label_2"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:text="Type here:"/>
+        <RelativeLayout android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:background="#FF000000"
+                        android:padding="10px"
+                        android:layoutDirection="ltr">
 
-        <EditText android:id="@+id/entry_2"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/label_2"/>
+            <TextView android:id="@+id/label_2"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:text="Type here:"/>
 
-        <Button android:id="@+id/ok_2"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_2"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK"/>
+            <EditText android:id="@+id/entry_2"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_below="@id/label_2"/>
 
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_2"
-                android:layout_alignTop="@id/ok_2"
-                android:text="Cancel"/>
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="fill_parent"
+            <Button android:id="@+id/ok_2"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="#FF000000"
-                    android:padding="10px"
-                    android:layoutDirection="inherit">
+                    android:layout_below="@id/entry_2"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10px"
+                    android:text="OK"/>
 
-        <TextView android:id="@+id/label_3"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:text="Type here:"/>
-
-        <EditText android:id="@+id/entry_3"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/label_3"/>
-
-        <Button android:id="@+id/ok_3"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_3"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK"/>
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_3"
-                android:layout_alignTop="@id/ok_3"
-                android:text="Cancel"/>
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="fill_parent"
+            <Button android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="#FF000000"
-                    android:padding="10px"
-                    android:layoutDirection="rtl">
+                    android:layout_toLeftOf="@id/ok_2"
+                    android:layout_alignTop="@id/ok_2"
+                    android:text="Cancel"/>
+        </RelativeLayout>
 
-        <TextView android:id="@+id/label_4"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:text="Type here:"/>
-
-        <EditText android:id="@+id/entry_4"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/label_4"/>
-
-        <Button android:id="@+id/ok_4"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_4"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK"/>
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_4"
-                android:layout_alignTop="@id/ok_4"
-                android:text="Cancel"/>
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="fill_parent"
+        <RelativeLayout android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:background="#FF000000"
+                        android:padding="10px"
+                        android:layoutDirection="inherit">
+    
+            <TextView android:id="@+id/label_3"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:text="Type here:"/>
+    
+            <EditText android:id="@+id/entry_3"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_below="@id/label_3"/>
+    
+            <Button android:id="@+id/ok_3"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="#FF000000"
-                    android:padding="10px"
-                    android:layoutDirection="locale">
+                    android:layout_below="@id/entry_3"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10px"
+                    android:text="OK"/>
+    
+            <Button android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_toLeftOf="@id/ok_3"
+                    android:layout_alignTop="@id/ok_3"
+                    android:text="Cancel"/>
+        </RelativeLayout>
 
-        <TextView android:id="@+id/label_4"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:text="Type here:"/>
+        <RelativeLayout android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:background="#FF000000"
+                        android:padding="10px"
+                        android:layoutDirection="rtl">
 
-        <EditText android:id="@+id/entry_4"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/label_4"/>
+            <TextView android:id="@+id/label_4"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:text="Type here:"/>
 
-        <Button android:id="@+id/ok_4"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_4"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK"/>
+            <EditText android:id="@+id/entry_4"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_below="@id/label_4"/>
 
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_4"
-                android:layout_alignTop="@id/ok_4"
-                android:text="Cancel"/>
-    </RelativeLayout>
+            <Button android:id="@+id/ok_4"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_below="@id/entry_4"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10px"
+                    android:text="OK"/>
 
-</LinearLayout>
\ No newline at end of file
+            <Button android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_toLeftOf="@id/ok_4"
+                    android:layout_alignTop="@id/ok_4"
+                    android:text="Cancel"/>
+        </RelativeLayout>
+
+        <RelativeLayout android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:background="#FF000000"
+                        android:padding="10px"
+                        android:layoutDirection="locale">
+    
+            <TextView android:id="@+id/label_4"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:text="Type here:"/>
+    
+            <EditText android:id="@+id/entry_4"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_below="@id/label_4"/>
+
+            <Button android:id="@+id/ok_4"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_below="@id/entry_4"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10px"
+                    android:text="OK"/>
+    
+            <Button android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_toLeftOf="@id/ok_4"
+                    android:layout_alignTop="@id/ok_4"
+                    android:text="Cancel"/>
+        </RelativeLayout>
+
+    </LinearLayout>
+
+</FrameLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/relative_layout_2_rtl.xml b/tests/BiDiTests/res/layout/relative_layout_2_rtl.xml
index 009d442..729f1ca 100644
--- a/tests/BiDiTests/res/layout/relative_layout_2_rtl.xml
+++ b/tests/BiDiTests/res/layout/relative_layout_2_rtl.xml
@@ -14,170 +14,170 @@
      limitations under the License.
 -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/relative_layout_ltr"
-              android:orientation="vertical"
-              android:layout_width="match_parent"
-              android:layout_height="match_parent"
-              android:layoutDirection="rtl">
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/relative_layout_2_rtl"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
 
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="fill_parent"
+    <LinearLayout android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="match_parent"
+                  android:layoutDirection="rtl">
+
+        <RelativeLayout android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:background="#FF000000"
+                        android:padding="10px">
+
+            <TextView android:id="@+id/label_1"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:text="Type here:"/>
+
+            <EditText android:id="@+id/entry_1"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_below="@id/label_1"/>
+
+            <Button android:id="@+id/ok_1"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="#FF000000"
-                    android:padding="10px">
+                    android:layout_below="@id/entry_1"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10px"
+                    android:text="OK"/>
 
-        <TextView android:id="@+id/label_1"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:text="Type here:"/>
-
-        <EditText android:id="@+id/entry_1"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/label_1"/>
-
-        <Button android:id="@+id/ok_1"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_1"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK"/>
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_1"
-                android:layout_alignTop="@id/ok_1"
-                android:text="Cancel"/>
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="fill_parent"
+            <Button android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="#FF000000"
-                    android:padding="10px"
-                    android:layoutDirection="ltr">
+                    android:layout_toLeftOf="@id/ok_1"
+                    android:layout_alignTop="@id/ok_1"
+                    android:text="Cancel"/>
+        </RelativeLayout>
 
-        <TextView android:id="@+id/label_2"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:text="Type here:"/>
+        <RelativeLayout android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:background="#FF000000"
+                        android:padding="10px"
+                        android:layoutDirection="ltr">
 
-        <EditText android:id="@+id/entry_2"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/label_2"/>
+            <TextView android:id="@+id/label_2"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:text="Type here:"/>
 
-        <Button android:id="@+id/ok_2"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_2"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK"/>
+            <EditText android:id="@+id/entry_2"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_below="@id/label_2"/>
 
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_2"
-                android:layout_alignTop="@id/ok_2"
-                android:text="Cancel"/>
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="fill_parent"
+            <Button android:id="@+id/ok_2"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="#FF000000"
-                    android:padding="10px"
-                    android:layoutDirection="inherit">
+                    android:layout_below="@id/entry_2"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10px"
+                    android:text="OK"/>
 
-        <TextView android:id="@+id/label_3"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:text="Type here:"/>
-
-        <EditText android:id="@+id/entry_3"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/label_3"/>
-
-        <Button android:id="@+id/ok_3"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_3"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK"/>
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_3"
-                android:layout_alignTop="@id/ok_3"
-                android:text="Cancel"/>
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="fill_parent"
+            <Button android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="#FF000000"
-                    android:padding="10px"
-                    android:layoutDirection="rtl">
+                    android:layout_toLeftOf="@id/ok_2"
+                    android:layout_alignTop="@id/ok_2"
+                    android:text="Cancel"/>
+        </RelativeLayout>
 
-        <TextView android:id="@+id/label_4"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:text="Type here:"/>
-
-        <EditText android:id="@+id/entry_4"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/label_4"/>
-
-        <Button android:id="@+id/ok_4"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_4"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK"/>
-
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_4"
-                android:layout_alignTop="@id/ok_4"
-                android:text="Cancel"/>
-    </RelativeLayout>
-
-    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                    android:layout_width="fill_parent"
+        <RelativeLayout android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:background="#FF000000"
+                        android:padding="10px"
+                        android:layoutDirection="inherit">
+    
+            <TextView android:id="@+id/label_3"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:text="Type here:"/>
+    
+            <EditText android:id="@+id/entry_3"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_below="@id/label_3"/>
+    
+            <Button android:id="@+id/ok_3"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:background="#FF000000"
-                    android:padding="10px"
-                    android:layoutDirection="locale">
+                    android:layout_below="@id/entry_3"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10px"
+                    android:text="OK"/>
+    
+            <Button android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_toLeftOf="@id/ok_3"
+                    android:layout_alignTop="@id/ok_3"
+                    android:text="Cancel"/>
+        </RelativeLayout>
 
-        <TextView android:id="@+id/label_4"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:text="Type here:"/>
+        <RelativeLayout android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:background="#FF000000"
+                        android:padding="10px"
+                        android:layoutDirection="rtl">
 
-        <EditText android:id="@+id/entry_4"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@id/label_4"/>
+            <TextView android:id="@+id/label_4"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:text="Type here:"/>
 
-        <Button android:id="@+id/ok_4"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/entry_4"
-                android:layout_alignParentRight="true"
-                android:layout_marginLeft="10px"
-                android:text="OK"/>
+            <EditText android:id="@+id/entry_4"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_below="@id/label_4"/>
 
-        <Button android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toLeftOf="@id/ok_4"
-                android:layout_alignTop="@id/ok_4"
-                android:text="Cancel"/>
-    </RelativeLayout>
+            <Button android:id="@+id/ok_4"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_below="@id/entry_4"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10px"
+                    android:text="OK"/>
 
-</LinearLayout>
\ No newline at end of file
+            <Button android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_toLeftOf="@id/ok_4"
+                    android:layout_alignTop="@id/ok_4"
+                    android:text="Cancel"/>
+        </RelativeLayout>
+
+        <RelativeLayout android:layout_width="fill_parent"
+                        android:layout_height="wrap_content"
+                        android:background="#FF000000"
+                        android:padding="10px"
+                        android:layoutDirection="locale">
+    
+            <TextView android:id="@+id/label_4"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:text="Type here:"/>
+    
+            <EditText android:id="@+id/entry_4"
+                      android:layout_width="fill_parent"
+                      android:layout_height="wrap_content"
+                      android:layout_below="@id/label_4"/>
+
+            <Button android:id="@+id/ok_4"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_below="@id/entry_4"
+                    android:layout_alignParentRight="true"
+                    android:layout_marginLeft="10px"
+                    android:text="OK"/>
+    
+            <Button android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_toLeftOf="@id/ok_4"
+                    android:layout_alignTop="@id/ok_4"
+                    android:text="Cancel"/>
+        </RelativeLayout>
+
+    </LinearLayout>
+
+</FrameLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/relative_layout_ltr.xml b/tests/BiDiTests/res/layout/relative_layout_ltr.xml
index e9e8661..461ec98 100644
--- a/tests/BiDiTests/res/layout/relative_layout_ltr.xml
+++ b/tests/BiDiTests/res/layout/relative_layout_ltr.xml
@@ -15,74 +15,78 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-             android:id="@+id/frame_layout_ltr"
-             android:layout_width="match_parent"
-             android:layout_height="match_parent"
-             android:layoutDirection="ltr"
-             android:background="#FF000000">
+        android:id="@+id/relative_layout_ltr"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="right|center_vertical"
-            android:background="#FFFF0000">
-    </RelativeLayout>
+    <FrameLayout android:layout_width="match_parent"
+                 android:layout_height="match_parent"
+                 android:layoutDirection="ltr"
+                 android:background="#FF000000">
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="left|center_vertical"
-            android:background="#FF00FF00">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="right|center_vertical"
+                android:background="#FFFF0000">
+        </RelativeLayout>
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="top|center_horizontal"
-            android:background="#FF0000FF">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="left|center_vertical"
+                android:background="#FF00FF00">
+        </RelativeLayout>
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="bottom|center_horizontal"
-            android:background="#FF00FFFF">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="top|center_horizontal"
+                android:background="#FF0000FF">
+        </RelativeLayout>
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="top|start"
-            android:background="#FFFFFFFF">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="bottom|center_horizontal"
+                android:background="#FF00FFFF">
+        </RelativeLayout>
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="top|end"
-            android:background="#FFFFFF00">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="top|start"
+                android:background="#FFFFFFFF">
+        </RelativeLayout>
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="bottom|start"
-            android:background="#FFFFFFFF">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="top|end"
+                android:background="#FFFFFF00">
+        </RelativeLayout>
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="bottom|end"
-            android:background="#FFFFFF00">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="bottom|start"
+                android:background="#FFFFFFFF">
+        </RelativeLayout>
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="center_horizontal|center_vertical"
-            android:background="#FF888888">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="bottom|end"
+                android:background="#FFFFFF00">
+        </RelativeLayout>
 
-</FrameLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="center_horizontal|center_vertical"
+                android:background="#FF888888">
+        </RelativeLayout>
+    
+    </FrameLayout>
 
+</FrameLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/relative_layout_rtl.xml b/tests/BiDiTests/res/layout/relative_layout_rtl.xml
index 57b2ad0..545d16e 100644
--- a/tests/BiDiTests/res/layout/relative_layout_rtl.xml
+++ b/tests/BiDiTests/res/layout/relative_layout_rtl.xml
@@ -15,74 +15,78 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-             android:id="@+id/frame_layout_rtl"
-             android:layout_width="match_parent"
-             android:layout_height="match_parent"
-             android:layoutDirection="rtl"
-             android:background="#FF000000">
+        android:id="@+id/relative_layout_rtl"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="right|center_vertical"
-            android:background="#FFFF0000">
-    </RelativeLayout>
+    <FrameLayout android:layout_width="match_parent"
+                 android:layout_height="match_parent"
+                 android:layoutDirection="rtl"
+                 android:background="#FF000000">
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="left|center_vertical"
-            android:background="#FF00FF00">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="right|center_vertical"
+                android:background="#FFFF0000">
+        </RelativeLayout>
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="top|center_horizontal"
-            android:background="#FF0000FF">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="left|center_vertical"
+                android:background="#FF00FF00">
+        </RelativeLayout>
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="bottom|center_horizontal"
-            android:background="#FF00FFFF">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="top|center_horizontal"
+                android:background="#FF0000FF">
+        </RelativeLayout>
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="top|start"
-            android:background="#FFFFFFFF">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="bottom|center_horizontal"
+                android:background="#FF00FFFF">
+        </RelativeLayout>
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="top|end"
-            android:background="#FFFFFF00">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="top|start"
+                android:background="#FFFFFFFF">
+        </RelativeLayout>
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="bottom|start"
-            android:background="#FFFFFFFF">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="top|end"
+                android:background="#FFFFFF00">
+        </RelativeLayout>
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="bottom|end"
-            android:background="#FFFFFF00">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="bottom|start"
+                android:background="#FFFFFFFF">
+        </RelativeLayout>
 
-    <RelativeLayout
-            android:layout_width="100dp"
-            android:layout_height="100dp"
-            android:layout_gravity="center_horizontal|center_vertical"
-            android:background="#FF888888">
-    </RelativeLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="bottom|end"
+                android:background="#FFFFFF00">
+        </RelativeLayout>
 
-</FrameLayout>
+        <RelativeLayout
+                android:layout_width="100dp"
+                android:layout_height="100dp"
+                android:layout_gravity="center_horizontal|center_vertical"
+                android:background="#FF888888">
+        </RelativeLayout>
+    
+    </FrameLayout>
 
+</FrameLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/table_layout_locale.xml b/tests/BiDiTests/res/layout/table_layout_locale.xml
index 847eb07..2589b40 100644
--- a/tests/BiDiTests/res/layout/table_layout_locale.xml
+++ b/tests/BiDiTests/res/layout/table_layout_locale.xml
@@ -14,245 +14,245 @@
      limitations under the License.
 -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/linear_layout_ltr"
-              android:orientation="vertical"
-              android:layout_width="match_parent"
-              android:layout_height="match_parent"
-              android:layoutDirection="locale">
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/table_layout_locale"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
 
-    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:stretchColumns="1,2">
+    <LinearLayout android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="match_parent"
+                  android:layoutDirection="locale">
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button1_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_right_text"
-                    android:textSize="24dip"
-                    android:gravity="right"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_after_text"
-                    android:textSize="24dip"
-                    android:gravity="after"
-                    />
-        </TableRow>
+        <TableLayout android:layout_width="wrap_content"
+                     android:layout_height="wrap_content"
+                     android:stretchColumns="1,2">
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button2_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_left_text"
-                    android:textSize="24dip"
-                    android:gravity="left"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_before_text"
-                    android:textSize="24dip"
-                    android:gravity="before"
-                    />
-        </TableRow>
-    </TableLayout>
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button1_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_right_text"
+                        android:textSize="24dip"
+                        android:gravity="right"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_after_text"
+                        android:textSize="24dip"
+                        android:gravity="after"
+                        />
+            </TableRow>
 
-    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:stretchColumns="1,2"
-                 android:layoutDirection="inherit">
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button2_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_left_text"
+                        android:textSize="24dip"
+                        android:gravity="left"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_before_text"
+                        android:textSize="24dip"
+                        android:gravity="before"
+                        />
+            </TableRow>
+        </TableLayout>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button1_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_right_text"
-                    android:textSize="24dip"
-                    android:gravity="right"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_after_text"
-                    android:textSize="24dip"
-                    android:gravity="after"
-                    />
-        </TableRow>
+        <TableLayout android:layout_width="wrap_content"
+                     android:layout_height="wrap_content"
+                     android:stretchColumns="1,2"
+                     android:layoutDirection="inherit">
+    
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button1_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_right_text"
+                        android:textSize="24dip"
+                        android:gravity="right"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_after_text"
+                        android:textSize="24dip"
+                        android:gravity="after"
+                        />
+            </TableRow>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button2_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_left_text"
-                    android:textSize="24dip"
-                    android:gravity="left"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_before_text"
-                    android:textSize="24dip"
-                    android:gravity="before"
-                    />
-        </TableRow>
-    </TableLayout>
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button2_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_left_text"
+                        android:textSize="24dip"
+                        android:gravity="left"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_before_text"
+                        android:textSize="24dip"
+                        android:gravity="before"
+                        />
+            </TableRow>
+        </TableLayout>
 
-    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:stretchColumns="1,2"
-                 android:layoutDirection="ltr">
+        <TableLayout android:layout_width="wrap_content"
+                     android:layout_height="wrap_content"
+                     android:stretchColumns="1,2"
+                     android:layoutDirection="ltr">
+    
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button1_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_right_text"
+                        android:textSize="24dip"
+                        android:gravity="right"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_after_text"
+                        android:textSize="24dip"
+                        android:gravity="after"
+                        />
+            </TableRow>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button1_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_right_text"
-                    android:textSize="24dip"
-                    android:gravity="right"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_after_text"
-                    android:textSize="24dip"
-                    android:gravity="after"
-                    />
-        </TableRow>
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button2_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_left_text"
+                        android:textSize="24dip"
+                        android:gravity="left"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_before_text"
+                        android:textSize="24dip"
+                        android:gravity="before"
+                        />
+            </TableRow>
+        </TableLayout>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button2_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_left_text"
-                    android:textSize="24dip"
-                    android:gravity="left"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_before_text"
-                    android:textSize="24dip"
-                    android:gravity="before"
-                    />
-        </TableRow>
-    </TableLayout>
+        <TableLayout android:layout_width="wrap_content"
+                     android:layout_height="wrap_content"
+                     android:stretchColumns="1,2"
+                     android:layoutDirection="rtl">
+    
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button1_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_right_text"
+                        android:textSize="24dip"
+                        android:gravity="right"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_after_text"
+                        android:textSize="24dip"
+                        android:gravity="after"
+                        />
+            </TableRow>
 
-    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:stretchColumns="1,2"
-                 android:layoutDirection="rtl">
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button2_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_left_text"
+                        android:textSize="24dip"
+                        android:gravity="left"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_before_text"
+                        android:textSize="24dip"
+                        android:gravity="before"
+                        />
+            </TableRow>
+        </TableLayout>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button1_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_right_text"
-                    android:textSize="24dip"
-                    android:gravity="right"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_after_text"
-                    android:textSize="24dip"
-                    android:gravity="after"
-                    />
-        </TableRow>
+        <TableLayout android:layout_width="wrap_content"
+                     android:layout_height="wrap_content"
+                     android:stretchColumns="1,2"
+                     android:layoutDirection="locale">
+    
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button1_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_right_text"
+                        android:textSize="24dip"
+                        android:gravity="right"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_after_text"
+                        android:textSize="24dip"
+                        android:gravity="after"
+                        />
+            </TableRow>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button2_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_left_text"
-                    android:textSize="24dip"
-                    android:gravity="left"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_before_text"
-                    android:textSize="24dip"
-                    android:gravity="before"
-                    />
-        </TableRow>
-    </TableLayout>
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button2_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_left_text"
+                        android:textSize="24dip"
+                        android:gravity="left"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_before_text"
+                        android:textSize="24dip"
+                        android:gravity="before"
+                        />
+            </TableRow>
+        </TableLayout>
 
-    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:stretchColumns="1,2"
-                 android:layoutDirection="locale">
+    </LinearLayout>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button1_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_right_text"
-                    android:textSize="24dip"
-                    android:gravity="right"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_after_text"
-                    android:textSize="24dip"
-                    android:gravity="after"
-                    />
-        </TableRow>
-
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button2_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_left_text"
-                    android:textSize="24dip"
-                    android:gravity="left"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_before_text"
-                    android:textSize="24dip"
-                    android:gravity="before"
-                    />
-        </TableRow>
-    </TableLayout>
-
-</LinearLayout>
\ No newline at end of file
+</FrameLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/table_layout_ltr.xml b/tests/BiDiTests/res/layout/table_layout_ltr.xml
index 49d1d0d..d8d412c 100644
--- a/tests/BiDiTests/res/layout/table_layout_ltr.xml
+++ b/tests/BiDiTests/res/layout/table_layout_ltr.xml
@@ -14,245 +14,245 @@
      limitations under the License.
 -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/linear_layout_ltr"
-              android:orientation="vertical"
-              android:layout_width="match_parent"
-              android:layout_height="match_parent"
-              android:layoutDirection="ltr">
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/table_layout_ltr"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
 
-    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:stretchColumns="1,2">
+    <LinearLayout android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="match_parent"
+                  android:layoutDirection="ltr">
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button1_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_right_text"
-                    android:textSize="24dip"
-                    android:gravity="right"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_after_text"
-                    android:textSize="24dip"
-                    android:gravity="after"
-                    />
-        </TableRow>
+        <TableLayout android:layout_width="wrap_content"
+                     android:layout_height="wrap_content"
+                     android:stretchColumns="1,2">
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button2_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_left_text"
-                    android:textSize="24dip"
-                    android:gravity="left"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_before_text"
-                    android:textSize="24dip"
-                    android:gravity="before"
-                    />
-        </TableRow>
-    </TableLayout>
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button1_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_right_text"
+                        android:textSize="24dip"
+                        android:gravity="right"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_after_text"
+                        android:textSize="24dip"
+                        android:gravity="after"
+                        />
+            </TableRow>
 
-    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:stretchColumns="1,2"
-                 android:layoutDirection="inherit">
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button2_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_left_text"
+                        android:textSize="24dip"
+                        android:gravity="left"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_before_text"
+                        android:textSize="24dip"
+                        android:gravity="before"
+                        />
+            </TableRow>
+        </TableLayout>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button1_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_right_text"
-                    android:textSize="24dip"
-                    android:gravity="right"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_after_text"
-                    android:textSize="24dip"
-                    android:gravity="after"
-                    />
-        </TableRow>
+        <TableLayout android:layout_width="wrap_content"
+                     android:layout_height="wrap_content"
+                     android:stretchColumns="1,2"
+                     android:layoutDirection="inherit">
+    
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button1_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_right_text"
+                        android:textSize="24dip"
+                        android:gravity="right"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_after_text"
+                        android:textSize="24dip"
+                        android:gravity="after"
+                        />
+            </TableRow>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button2_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_left_text"
-                    android:textSize="24dip"
-                    android:gravity="left"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_before_text"
-                    android:textSize="24dip"
-                    android:gravity="before"
-                    />
-        </TableRow>
-    </TableLayout>
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button2_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_left_text"
+                        android:textSize="24dip"
+                        android:gravity="left"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_before_text"
+                        android:textSize="24dip"
+                        android:gravity="before"
+                        />
+            </TableRow>
+        </TableLayout>
 
-    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:stretchColumns="1,2"
-                 android:layoutDirection="ltr">
+        <TableLayout android:layout_width="wrap_content"
+                     android:layout_height="wrap_content"
+                     android:stretchColumns="1,2"
+                     android:layoutDirection="ltr">
+    
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button1_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_right_text"
+                        android:textSize="24dip"
+                        android:gravity="right"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_after_text"
+                        android:textSize="24dip"
+                        android:gravity="after"
+                        />
+            </TableRow>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button1_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_right_text"
-                    android:textSize="24dip"
-                    android:gravity="right"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_after_text"
-                    android:textSize="24dip"
-                    android:gravity="after"
-                    />
-        </TableRow>
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button2_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_left_text"
+                        android:textSize="24dip"
+                        android:gravity="left"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_before_text"
+                        android:textSize="24dip"
+                        android:gravity="before"
+                        />
+            </TableRow>
+        </TableLayout>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button2_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_left_text"
-                    android:textSize="24dip"
-                    android:gravity="left"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_before_text"
-                    android:textSize="24dip"
-                    android:gravity="before"
-                    />
-        </TableRow>
-    </TableLayout>
+        <TableLayout android:layout_width="wrap_content"
+                     android:layout_height="wrap_content"
+                     android:stretchColumns="1,2"
+                     android:layoutDirection="rtl">
+    
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button1_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_right_text"
+                        android:textSize="24dip"
+                        android:gravity="right"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_after_text"
+                        android:textSize="24dip"
+                        android:gravity="after"
+                        />
+            </TableRow>
 
-    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:stretchColumns="1,2"
-                 android:layoutDirection="rtl">
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button2_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_left_text"
+                        android:textSize="24dip"
+                        android:gravity="left"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_before_text"
+                        android:textSize="24dip"
+                        android:gravity="before"
+                        />
+            </TableRow>
+        </TableLayout>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button1_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_right_text"
-                    android:textSize="24dip"
-                    android:gravity="right"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_after_text"
-                    android:textSize="24dip"
-                    android:gravity="after"
-                    />
-        </TableRow>
+        <TableLayout android:layout_width="wrap_content"
+                     android:layout_height="wrap_content"
+                     android:stretchColumns="1,2"
+                     android:layoutDirection="locale">
+    
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button1_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_right_text"
+                        android:textSize="24dip"
+                        android:gravity="right"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_after_text"
+                        android:textSize="24dip"
+                        android:gravity="after"
+                        />
+            </TableRow>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button2_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_left_text"
-                    android:textSize="24dip"
-                    android:gravity="left"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_before_text"
-                    android:textSize="24dip"
-                    android:gravity="before"
-                    />
-        </TableRow>
-    </TableLayout>
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button2_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_left_text"
+                        android:textSize="24dip"
+                        android:gravity="left"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_before_text"
+                        android:textSize="24dip"
+                        android:gravity="before"
+                        />
+            </TableRow>
+        </TableLayout>
 
-    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:stretchColumns="1,2"
-                 android:layoutDirection="locale">
+    </LinearLayout>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button1_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_right_text"
-                    android:textSize="24dip"
-                    android:gravity="right"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_after_text"
-                    android:textSize="24dip"
-                    android:gravity="after"
-                    />
-        </TableRow>
-
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button2_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_left_text"
-                    android:textSize="24dip"
-                    android:gravity="left"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_before_text"
-                    android:textSize="24dip"
-                    android:gravity="before"
-                    />
-        </TableRow>
-    </TableLayout>
-
-</LinearLayout>
\ No newline at end of file
+</FrameLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/res/layout/table_layout_rtl.xml b/tests/BiDiTests/res/layout/table_layout_rtl.xml
index a665e45..53130fe2 100644
--- a/tests/BiDiTests/res/layout/table_layout_rtl.xml
+++ b/tests/BiDiTests/res/layout/table_layout_rtl.xml
@@ -14,245 +14,245 @@
      limitations under the License.
 -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:id="@+id/linear_layout_ltr"
-              android:orientation="vertical"
-              android:layout_width="match_parent"
-              android:layout_height="match_parent"
-              android:layoutDirection="rtl">
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/table_layout_rtl"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
 
-    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:stretchColumns="1,2">
+    <LinearLayout android:orientation="vertical"
+                  android:layout_width="match_parent"
+                  android:layout_height="match_parent"
+                  android:layoutDirection="rtl">
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button1_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_right_text"
-                    android:textSize="24dip"
-                    android:gravity="right"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_after_text"
-                    android:textSize="24dip"
-                    android:gravity="after"
-                    />
-        </TableRow>
+        <TableLayout android:layout_width="wrap_content"
+                     android:layout_height="wrap_content"
+                     android:stretchColumns="1,2">
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button2_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_left_text"
-                    android:textSize="24dip"
-                    android:gravity="left"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_before_text"
-                    android:textSize="24dip"
-                    android:gravity="before"
-                    />
-        </TableRow>
-    </TableLayout>
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button1_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_right_text"
+                        android:textSize="24dip"
+                        android:gravity="right"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_after_text"
+                        android:textSize="24dip"
+                        android:gravity="after"
+                        />
+            </TableRow>
 
-    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:stretchColumns="1,2"
-                 android:layoutDirection="inherit">
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button2_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_left_text"
+                        android:textSize="24dip"
+                        android:gravity="left"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_before_text"
+                        android:textSize="24dip"
+                        android:gravity="before"
+                        />
+            </TableRow>
+        </TableLayout>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button1_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_right_text"
-                    android:textSize="24dip"
-                    android:gravity="right"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_after_text"
-                    android:textSize="24dip"
-                    android:gravity="after"
-                    />
-        </TableRow>
+        <TableLayout android:layout_width="wrap_content"
+                     android:layout_height="wrap_content"
+                     android:stretchColumns="1,2"
+                     android:layoutDirection="inherit">
+    
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button1_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_right_text"
+                        android:textSize="24dip"
+                        android:gravity="right"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_after_text"
+                        android:textSize="24dip"
+                        android:gravity="after"
+                        />
+            </TableRow>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button2_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_left_text"
-                    android:textSize="24dip"
-                    android:gravity="left"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_before_text"
-                    android:textSize="24dip"
-                    android:gravity="before"
-                    />
-        </TableRow>
-    </TableLayout>
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button2_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_left_text"
+                        android:textSize="24dip"
+                        android:gravity="left"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_before_text"
+                        android:textSize="24dip"
+                        android:gravity="before"
+                        />
+            </TableRow>
+        </TableLayout>
 
-    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:stretchColumns="1,2"
-                 android:layoutDirection="ltr">
+        <TableLayout android:layout_width="wrap_content"
+                     android:layout_height="wrap_content"
+                     android:stretchColumns="1,2"
+                     android:layoutDirection="ltr">
+    
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button1_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_right_text"
+                        android:textSize="24dip"
+                        android:gravity="right"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_after_text"
+                        android:textSize="24dip"
+                        android:gravity="after"
+                        />
+            </TableRow>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button1_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_right_text"
-                    android:textSize="24dip"
-                    android:gravity="right"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_after_text"
-                    android:textSize="24dip"
-                    android:gravity="after"
-                    />
-        </TableRow>
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button2_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_left_text"
+                        android:textSize="24dip"
+                        android:gravity="left"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_before_text"
+                        android:textSize="24dip"
+                        android:gravity="before"
+                        />
+            </TableRow>
+        </TableLayout>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button2_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_left_text"
-                    android:textSize="24dip"
-                    android:gravity="left"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_before_text"
-                    android:textSize="24dip"
-                    android:gravity="before"
-                    />
-        </TableRow>
-    </TableLayout>
+        <TableLayout android:layout_width="wrap_content"
+                     android:layout_height="wrap_content"
+                     android:stretchColumns="1,2"
+                     android:layoutDirection="rtl">
+    
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button1_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_right_text"
+                        android:textSize="24dip"
+                        android:gravity="right"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_after_text"
+                        android:textSize="24dip"
+                        android:gravity="after"
+                        />
+            </TableRow>
 
-    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:stretchColumns="1,2"
-                 android:layoutDirection="rtl">
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button2_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_left_text"
+                        android:textSize="24dip"
+                        android:gravity="left"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_before_text"
+                        android:textSize="24dip"
+                        android:gravity="before"
+                        />
+            </TableRow>
+        </TableLayout>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button1_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_right_text"
-                    android:textSize="24dip"
-                    android:gravity="right"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_after_text"
-                    android:textSize="24dip"
-                    android:gravity="after"
-                    />
-        </TableRow>
+        <TableLayout android:layout_width="wrap_content"
+                     android:layout_height="wrap_content"
+                     android:stretchColumns="1,2"
+                     android:layoutDirection="locale">
+    
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button1_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_right_text"
+                        android:textSize="24dip"
+                        android:gravity="right"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_after_text"
+                        android:textSize="24dip"
+                        android:gravity="after"
+                        />
+            </TableRow>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button2_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_left_text"
-                    android:textSize="24dip"
-                    android:gravity="left"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_before_text"
-                    android:textSize="24dip"
-                    android:gravity="before"
-                    />
-        </TableRow>
-    </TableLayout>
+            <TableRow>
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button2_text"
+                        android:textSize="24dip"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_left_text"
+                        android:textSize="24dip"
+                        android:gravity="left"
+                        />
+                <Button android:layout_height="wrap_content"
+                        android:layout_width="wrap_content"
+                        android:text="@string/button_before_text"
+                        android:textSize="24dip"
+                        android:gravity="before"
+                        />
+            </TableRow>
+        </TableLayout>
 
-    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                 android:layout_width="wrap_content"
-                 android:layout_height="wrap_content"
-                 android:stretchColumns="1,2"
-                 android:layoutDirection="locale">
+    </LinearLayout>
 
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button1_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_right_text"
-                    android:textSize="24dip"
-                    android:gravity="right"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_after_text"
-                    android:textSize="24dip"
-                    android:gravity="after"
-                    />
-        </TableRow>
-
-        <TableRow>
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button2_text"
-                    android:textSize="24dip"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_left_text"
-                    android:textSize="24dip"
-                    android:gravity="left"
-                    />
-            <Button android:layout_height="wrap_content"
-                    android:layout_width="wrap_content"
-                    android:text="@string/button_before_text"
-                    android:textSize="24dip"
-                    android:gravity="before"
-                    />
-        </TableRow>
-    </TableLayout>
-
-</LinearLayout>
\ No newline at end of file
+</FrameLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java
index 1ffe7ee..a3a0041 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java
@@ -16,12 +16,56 @@
 
 package com.android.bidi;
 
-import android.app.TabActivity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.widget.TabHost;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
-public class BiDiTestActivity extends TabActivity {
+import android.app.Activity;
+import android.app.Fragment;
+import android.app.FragmentTransaction;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ListView;
+import android.widget.SimpleAdapter;
+
+public class BiDiTestActivity extends Activity {
+
+    private static final String KEY_CLASS = "class";
+    private static final String KEY_TITLE = "title";
+    private static final String KEY_FRAGMENT_ID = "id";
+    
+    private ListView mList;
+    
+    private AdapterView.OnItemClickListener mOnClickListener = 
+            new AdapterView.OnItemClickListener() {
+                public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
+                    onListItemClick((ListView)parent, v, position, id);
+                }
+    };
+
+    private void onListItemClick(ListView lv, View v, int position, long id) {
+        // Show the test
+        Map<String, Object> map = (Map<String, Object>)lv.getItemAtPosition(position);
+        int fragmentId = (Integer) map.get(KEY_FRAGMENT_ID);
+        Fragment fragment = getFragmentManager().findFragmentById(fragmentId);
+        if (fragment == null) {
+            try {
+                // Create an instance of the test
+                Class<? extends Fragment> clazz = (Class<? extends Fragment>) map.get(KEY_CLASS);  
+                fragment = clazz.newInstance();
+                
+                // Replace the old test fragment with the new one
+                FragmentTransaction ft = getFragmentManager().beginTransaction();
+                ft.replace(R.id.testframe, fragment);
+                ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
+                ft.commit();
+            } catch (InstantiationException e) {
+            } catch (IllegalAccessException e) {
+            }
+        }
+    }
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -29,94 +73,52 @@
 
         setContentView(R.layout.main);
 
-        TabHost tabHost = getTabHost();
-        TabHost.TabSpec spec;
-        Intent intent;
+        mList = (ListView) findViewById(R.id.testlist);
+        mList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
+        mList.setFocusableInTouchMode(true);
+        
+        final SimpleAdapter adapter = new SimpleAdapter(this, getTests(),
+                R.layout.custom_list_item, new String[]{"title"},
+                new int[]{android.R.id.text1});
+        mList.setAdapter(adapter);
+        
+        mList.setOnItemClickListener(mOnClickListener);
+    }
 
-        // Create an Intent to launch an Activity for the tab (to be reused)
-        intent = new Intent().setClass(this, BiDiTestBasicActivity.class);
+    private void addItem(List<Map<String, Object>> data, String name,
+            Class<? extends Fragment> clazz, int fragmentId) {
+        Map<String, Object> temp = new HashMap<String, Object>();
+        temp.put(KEY_TITLE, name);
+        temp.put(KEY_CLASS, clazz);
+        temp.put(KEY_FRAGMENT_ID, fragmentId);
+        data.add(temp);
+    }
 
-        // Initialize a TabSpec for each tab and add it to the TabHost
-        spec = tabHost.newTabSpec("basic").setIndicator("Basic").
-            setContent(intent);
-        tabHost.addTab(spec);
+    private List<Map<String, Object>> getTests() {
+        List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
 
-        // Do the same for the other tabs
-        intent = new Intent().setClass(this, BiDiTestCanvasActivity.class);
-        spec = tabHost.newTabSpec("canvas").setIndicator("Canvas").
-            setContent(intent);
-        tabHost.addTab(spec);
+        addItem(result, "Basic", BiDiTestBasic.class, R.id.basic);
+        addItem(result, "Canvas", BiDiTestCanvas.class, R.id.canvas);
+        
+        addItem(result, "Linear LTR", BiDiTestLinearLayoutLtr.class, R.id.linear_layout_ltr);
+        addItem(result, "Linear RTL", BiDiTestLinearLayoutRtl.class, R.id.linear_layout_rtl);
+        addItem(result, "Linear LOC", BiDiTestLinearLayoutLocale.class, R.id.linear_layout_locale);
+        
+        addItem(result, "Frame LTR", BiDiTestFrameLayoutLtr.class, R.id.frame_layout_ltr);
+        addItem(result, "Frame RTL", BiDiTestFrameLayoutRtl.class, R.id.frame_layout_rtl);
+        addItem(result, "Frame LOC", BiDiTestFrameLayoutLocale.class, R.id.frame_layout_locale);
+        
+        addItem(result, "Relative LTR", BiDiTestRelativeLayoutLtr.class, R.id.relative_layout_ltr);
+        addItem(result, "Relative RTL", BiDiTestRelativeLayoutRtl.class, R.id.relative_layout_rtl);
+        
+        addItem(result, "Relative2 LTR", BiDiTestRelativeLayout2Ltr.class, R.id.relative_layout_2_ltr);
+        addItem(result, "Relative2 RTL", BiDiTestRelativeLayout2Rtl.class, R.id.relative_layout_2_rtl);
+        addItem(result, "Relative2 LOC", BiDiTestRelativeLayout2Locale.class, R.id.relative_layout_2_locale);
+        
+        addItem(result, "Table LTR", BiDiTestTableLayoutLtr.class, R.id.table_layout_ltr);
+        addItem(result, "Table RTL", BiDiTestTableLayoutRtl.class, R.id.table_layout_rtl);
+        addItem(result, "Table LOC", BiDiTestTableLayoutLocale.class, R.id.table_layout_locale);
 
-        intent = new Intent().setClass(this, BiDiTestLinearLayoutLtrActivity.class);
-        spec = tabHost.newTabSpec("linear-layout-ltr").setIndicator("Linear LTR").
-            setContent(intent);
-        tabHost.addTab(spec);
-
-        intent = new Intent().setClass(this, BiDiTestLinearLayoutRtlActivity.class);
-        spec = tabHost.newTabSpec("linear-layout-rtl").setIndicator("Linear RTL").
-            setContent(intent);
-        tabHost.addTab(spec);
-
-        intent = new Intent().setClass(this, BiDiTestLinearLayoutLocaleActivity.class);
-        spec = tabHost.newTabSpec("linear-layout-locale").setIndicator("Linear LOC").
-            setContent(intent);
-        tabHost.addTab(spec);
-
-        intent = new Intent().setClass(this, BiDiTestFrameLayoutLtrActivity.class);
-        spec = tabHost.newTabSpec("frame-layout-ltr").setIndicator("Frame LTR").
-            setContent(intent);
-        tabHost.addTab(spec);
-
-        intent = new Intent().setClass(this, BiDiTestFrameLayoutRtlActivity.class);
-        spec = tabHost.newTabSpec("frame-layout-rtl").setIndicator("Frame RTL").
-            setContent(intent);
-        tabHost.addTab(spec);
-
-        intent = new Intent().setClass(this, BiDiTestFrameLayoutLocaleActivity.class);
-        spec = tabHost.newTabSpec("frame-layout-locale").setIndicator("Frame LOC").
-            setContent(intent);
-        tabHost.addTab(spec);
-
-        intent = new Intent().setClass(this, BiDiTestRelativeLayoutLtrActivity.class);
-        spec = tabHost.newTabSpec("relative-layout-ltr").setIndicator("Relative LTR").
-            setContent(intent);
-        tabHost.addTab(spec);
-
-        intent = new Intent().setClass(this, BiDiTestRelativeLayoutRtlActivity.class);
-        spec = tabHost.newTabSpec("relative-layout-rtl").setIndicator("Relative RTL").
-            setContent(intent);
-        tabHost.addTab(spec);
-
-        intent = new Intent().setClass(this, BiDiTestRelativeLayoutLtrActivity2.class);
-        spec = tabHost.newTabSpec("relative-layout-ltr-2").setIndicator("Relative2 LTR").
-            setContent(intent);
-        tabHost.addTab(spec);
-
-        intent = new Intent().setClass(this, BiDiTestRelativeLayoutRtlActivity2.class);
-        spec = tabHost.newTabSpec("relative-layout-rtl-2").setIndicator("Relative2 RTL").
-            setContent(intent);
-        tabHost.addTab(spec);
-
-        intent = new Intent().setClass(this, BiDiTestRelativeLayoutLocaleActivity2.class);
-        spec = tabHost.newTabSpec("relative-layout-locale-2").setIndicator("Relative2 LOC").
-            setContent(intent);
-        tabHost.addTab(spec);
-
-        intent = new Intent().setClass(this, BiDiTestTableLayoutLtrActivity.class);
-        spec = tabHost.newTabSpec("table-layout-ltr").setIndicator("Table LTR").
-            setContent(intent);
-        tabHost.addTab(spec);
-
-        intent = new Intent().setClass(this, BiDiTestTableLayoutRtlActivity.class);
-        spec = tabHost.newTabSpec("table-layout-rtl").setIndicator("Table RTL").
-            setContent(intent);
-        tabHost.addTab(spec);
-
-        intent = new Intent().setClass(this, BiDiTestTableLayoutLocaleActivity.class);
-        spec = tabHost.newTabSpec("table-layout-locale").setIndicator("Table LOC").
-            setContent(intent);
-        tabHost.addTab(spec);
-
-        tabHost.setCurrentTab(0);
+        return result;
     }
 }
\ No newline at end of file
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestBasic.java
similarity index 66%
rename from tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
rename to tests/BiDiTests/src/com/android/bidi/BiDiTestBasic.java
index 8694dd1..9b3918d 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestBasic.java
@@ -16,15 +16,17 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
-public class BiDiTestLinearLayoutLocaleActivity extends Activity {
-
+public class BiDiTestBasic extends Fragment {
+    
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_locale);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.basic, container, false);
     }
 }
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestBasicActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestBasicActivity.java
deleted file mode 100644
index 2a8de04..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestBasicActivity.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.bidi;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class BiDiTestBasicActivity extends Activity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.basic);
-    }
-}
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestCanvasActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestCanvas.java
similarity index 69%
rename from tests/BiDiTests/src/com/android/bidi/BiDiTestCanvasActivity.java
rename to tests/BiDiTests/src/com/android/bidi/BiDiTestCanvas.java
index 3ab75d5..33ed731 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestCanvasActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestCanvas.java
@@ -16,30 +16,39 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 import android.widget.SeekBar;
 
 import static com.android.bidi.BiDiTestConstants.FONT_MAX_SIZE;
 import static com.android.bidi.BiDiTestConstants.FONT_MIN_SIZE;
 
-public class BiDiTestCanvasActivity extends Activity {
+public class BiDiTestCanvas extends Fragment {
 
     static final int INIT_TEXT_SIZE = (FONT_MAX_SIZE - FONT_MIN_SIZE) / 2;
 
     private BiDiTestView testView;
     private SeekBar textSizeSeekBar;
+    private View currentView;
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        currentView = inflater.inflate(R.layout.canvas, container, false);
+        return currentView;
+    }
 
-        setContentView(R.layout.canvas);
+    @Override
+    public void onViewCreated(View view, Bundle savedInstanceState) {
+        super.onViewCreated(view, savedInstanceState);
 
-        testView = (BiDiTestView) findViewById(R.id.testview);
+        testView = (BiDiTestView) currentView.findViewById(R.id.testview);
         testView.setCurrentTextSize(INIT_TEXT_SIZE);
 
-        textSizeSeekBar = (SeekBar) findViewById(R.id.seekbar);
+        textSizeSeekBar = (SeekBar) currentView.findViewById(R.id.seekbar);
         textSizeSeekBar.setProgress(INIT_TEXT_SIZE);
         textSizeSeekBar.setMax(FONT_MAX_SIZE - FONT_MIN_SIZE);
 
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLocale.java
similarity index 64%
copy from tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
copy to tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLocale.java
index 8694dd1..900bcd1 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLocale.java
@@ -16,15 +16,18 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
-public class BiDiTestLinearLayoutLocaleActivity extends Activity {
+public class BiDiTestFrameLayoutLocale extends Fragment {
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_locale);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.frame_layout_locale, container, false);
     }
 }
+
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLocaleActivity.java
deleted file mode 100644
index 457c52a..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLocaleActivity.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.bidi;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class BiDiTestFrameLayoutLocaleActivity extends Activity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.frame_layout_locale);
-    }
-}
-
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLtr.java
similarity index 65%
copy from tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
copy to tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLtr.java
index 8694dd1..43900da 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLtr.java
@@ -16,15 +16,18 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
-public class BiDiTestLinearLayoutLocaleActivity extends Activity {
+public class BiDiTestFrameLayoutLtr extends Fragment {
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_locale);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.frame_layout_ltr, container, false);
     }
 }
+
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLtrActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLtrActivity.java
deleted file mode 100644
index 6ce4fe4..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLtrActivity.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.bidi;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class BiDiTestFrameLayoutLtrActivity extends Activity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.frame_layout_ltr);
-    }
-}
-
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutRtl.java
similarity index 65%
copy from tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
copy to tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutRtl.java
index 8694dd1..a261449 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutRtl.java
@@ -16,15 +16,18 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
-public class BiDiTestLinearLayoutLocaleActivity extends Activity {
+public class BiDiTestFrameLayoutRtl extends Fragment {
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_locale);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.frame_layout_rtl, container, false);
     }
 }
+
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutRtlActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutRtlActivity.java
deleted file mode 100644
index 6012a5c..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutRtlActivity.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.bidi;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class BiDiTestFrameLayoutRtlActivity extends Activity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.frame_layout_rtl);
-    }
-}
-
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocale.java
similarity index 64%
copy from tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
copy to tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocale.java
index 8694dd1..ad686df 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocale.java
@@ -16,15 +16,17 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
-public class BiDiTestLinearLayoutLocaleActivity extends Activity {
+public class BiDiTestLinearLayoutLocale extends Fragment {
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_locale);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.linear_layout_locale, container, false);
     }
 }
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLtr.java
similarity index 65%
copy from tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
copy to tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLtr.java
index 8694dd1..da9195a 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLtr.java
@@ -16,15 +16,17 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
-public class BiDiTestLinearLayoutLocaleActivity extends Activity {
+public class BiDiTestLinearLayoutLtr extends Fragment {
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_locale);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.linear_layout_ltr, container, false);
     }
 }
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLtrActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLtrActivity.java
deleted file mode 100644
index 280af6a..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLtrActivity.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.bidi;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class BiDiTestLinearLayoutLtrActivity extends Activity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_ltr);
-    }
-}
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutRtl.java
similarity index 65%
copy from tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
copy to tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutRtl.java
index 8694dd1..dfe247f 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutRtl.java
@@ -16,15 +16,17 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
-public class BiDiTestLinearLayoutLocaleActivity extends Activity {
+public class BiDiTestLinearLayoutRtl extends Fragment {
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_locale);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.linear_layout_rtl, container, false);
     }
 }
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutRtlActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutRtlActivity.java
deleted file mode 100644
index 7121a62..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutRtlActivity.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.bidi;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class BiDiTestLinearLayoutRtlActivity extends Activity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_rtl);
-    }
-}
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayout2Locale.java
similarity index 64%
copy from tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
copy to tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayout2Locale.java
index 8694dd1..957f189 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayout2Locale.java
@@ -16,15 +16,18 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
-public class BiDiTestLinearLayoutLocaleActivity extends Activity {
+public class BiDiTestRelativeLayout2Locale extends Fragment {
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_locale);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.relative_layout_2_locale, container, false);
     }
 }
+
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayout2Ltr.java
similarity index 64%
copy from tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
copy to tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayout2Ltr.java
index 8694dd1..a27b3a4 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayout2Ltr.java
@@ -16,15 +16,18 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
-public class BiDiTestLinearLayoutLocaleActivity extends Activity {
+public class BiDiTestRelativeLayout2Ltr extends Fragment {
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_locale);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.relative_layout_2_ltr, container, false);
     }
 }
+
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayout2Rtl.java
similarity index 64%
copy from tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
copy to tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayout2Rtl.java
index 8694dd1..6185a6f 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayout2Rtl.java
@@ -16,15 +16,18 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
-public class BiDiTestLinearLayoutLocaleActivity extends Activity {
+public class BiDiTestRelativeLayout2Rtl extends Fragment {
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_locale);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.relative_layout_2_rtl, container, false);
     }
 }
+
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLocaleActivity2.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLocaleActivity2.java
deleted file mode 100644
index 8a52b38..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLocaleActivity2.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.bidi;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class BiDiTestRelativeLayoutLocaleActivity2 extends Activity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.relative_layout_2_locale);
-    }
-}
-
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtr.java
similarity index 64%
copy from tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
copy to tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtr.java
index 8694dd1..d854e7a 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtr.java
@@ -16,15 +16,18 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
-public class BiDiTestLinearLayoutLocaleActivity extends Activity {
+public class BiDiTestRelativeLayoutLtr extends Fragment {
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_locale);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.relative_layout_ltr, container, false);
     }
 }
+
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity.java
deleted file mode 100644
index d6b8d02..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.bidi;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class BiDiTestRelativeLayoutLtrActivity extends Activity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.relative_layout_ltr);
-    }
-}
-
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity2.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity2.java
deleted file mode 100644
index 65a5ed0..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity2.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.bidi;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class BiDiTestRelativeLayoutLtrActivity2 extends Activity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.relative_layout_2_ltr);
-    }
-}
-
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtl.java
similarity index 64%
copy from tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
copy to tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtl.java
index 8694dd1..ed5607a 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtl.java
@@ -16,15 +16,18 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
-public class BiDiTestLinearLayoutLocaleActivity extends Activity {
+public class BiDiTestRelativeLayoutRtl extends Fragment {
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_locale);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.relative_layout_rtl, container, false);
     }
 }
+
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity.java
deleted file mode 100644
index 683b7a3..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.bidi;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class BiDiTestRelativeLayoutRtlActivity extends Activity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.relative_layout_rtl);
-    }
-}
-
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity2.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity2.java
deleted file mode 100644
index dad5491..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity2.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.bidi;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class BiDiTestRelativeLayoutRtlActivity2 extends Activity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.relative_layout_2_rtl);
-    }
-}
-
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLocale.java
similarity index 64%
copy from tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
copy to tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLocale.java
index 8694dd1..7172c94 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLocale.java
@@ -16,15 +16,18 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
-public class BiDiTestLinearLayoutLocaleActivity extends Activity {
+public class BiDiTestTableLayoutLocale extends Fragment {
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_locale);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.table_layout_locale, container, false);
     }
 }
+
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLocaleActivity.java
deleted file mode 100644
index 9222aa2..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLocaleActivity.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.bidi;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class BiDiTestTableLayoutLocaleActivity extends Activity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.table_layout_locale);
-    }
-}
-
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLtr.java
similarity index 65%
copy from tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
copy to tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLtr.java
index 8694dd1..ef75b5e 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLtr.java
@@ -16,15 +16,18 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
-public class BiDiTestLinearLayoutLocaleActivity extends Activity {
+public class BiDiTestTableLayoutLtr extends Fragment {
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_locale);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.table_layout_ltr, container, false);
     }
 }
+
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLtrActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLtrActivity.java
deleted file mode 100644
index 0719dae..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLtrActivity.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.bidi;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class BiDiTestTableLayoutLtrActivity extends Activity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.table_layout_ltr);
-    }
-}
-
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutRtl.java
similarity index 65%
copy from tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
copy to tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutRtl.java
index 8694dd1..d3c20ff 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLocaleActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutRtl.java
@@ -16,15 +16,18 @@
 
 package com.android.bidi;
 
-import android.app.Activity;
+import android.app.Fragment;
 import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
-public class BiDiTestLinearLayoutLocaleActivity extends Activity {
+public class BiDiTestTableLayoutRtl extends Fragment {
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.linear_layout_locale);
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        return inflater.inflate(R.layout.table_layout_rtl, container, false);
     }
 }
+
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutRtlActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutRtlActivity.java
deleted file mode 100644
index 3553ed8..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutRtlActivity.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-package com.android.bidi;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class BiDiTestTableLayoutRtlActivity extends Activity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.table_layout_rtl);
-    }
-}
-