diff --git a/java/src/com/android/inputmethod/compat/FrameLayoutCompatUtils.java b/java/src/com/android/inputmethod/compat/FrameLayoutCompatUtils.java
new file mode 100644
index 0000000..46499f1
--- /dev/null
+++ b/java/src/com/android/inputmethod/compat/FrameLayoutCompatUtils.java
@@ -0,0 +1,52 @@
+/*
+ * 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.inputmethod.compat;
+
+import android.view.ViewGroup;
+import android.view.ViewGroup.MarginLayoutParams;
+import android.widget.FrameLayout;
+import android.widget.RelativeLayout;
+
+public class FrameLayoutCompatUtils {
+    private static final boolean NEEDS_FRAME_LAYOUT_HACK = (
+            android.os.Build.VERSION.SDK_INT < 11 /* Honeycomb */);
+
+    public static ViewGroup getPlacer(ViewGroup container) {
+        if (NEEDS_FRAME_LAYOUT_HACK) {
+            // Insert RelativeLayout to be able to setMargin because pre-Honeycomb FrameLayout
+            // could not handle setMargin properly.
+            final ViewGroup placer = new RelativeLayout(container.getContext());
+            container.addView(placer);
+            return placer;
+        } else {
+            return container;
+        }
+    }
+
+    public static MarginLayoutParams newLayoutParam(ViewGroup placer, int width, int height) {
+        if (placer instanceof FrameLayout) {
+            return new FrameLayout.LayoutParams(width, height);
+        } else if (placer instanceof RelativeLayout) {
+            return new RelativeLayout.LayoutParams(width, height);
+        } else if (placer == null) {
+            throw new NullPointerException("placer is null");
+        } else {
+            throw new IllegalArgumentException("placer is neither FrameLayout nor RelativeLayout: "
+                    + placer.getClass().getName());
+        }
+    }
+}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 4c6f29a..c372281 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -42,11 +42,10 @@
 import android.view.ViewConfiguration;
 import android.view.ViewGroup;
 import android.view.ViewGroup.MarginLayoutParams;
-import android.widget.FrameLayout;
-import android.widget.LinearLayout;
 import android.widget.PopupWindow;
 import android.widget.TextView;
 
+import com.android.inputmethod.compat.FrameLayoutCompatUtils;
 import com.android.inputmethod.keyboard.internal.Key;
 import com.android.inputmethod.keyboard.internal.MiniKeyboardBuilder;
 import com.android.inputmethod.keyboard.internal.PointerTrackerQueue;
@@ -946,27 +945,12 @@
     }
 
     private void addKeyPreview(TextView keyPreview) {
-        ViewGroup placer = mPreviewPlacer;
-        if (placer == null) {
-            final FrameLayout screenContent = (FrameLayout) getRootView().findViewById(
-                    android.R.id.content);
-            if (android.os.Build.VERSION.SDK_INT >= /* HONEYCOMB */11) {
-                placer = screenContent;
-            } else {
-                // Insert LinearLayout to be able to setMargin because pre-Honeycomb FrameLayout
-                // could not handle setMargin properly.
-                placer = new LinearLayout(getContext());
-                screenContent.addView(placer);
-            }
-            mPreviewPlacer = placer;
+        if (mPreviewPlacer == null) {
+            mPreviewPlacer = FrameLayoutCompatUtils.getPlacer(
+                    (ViewGroup)getRootView().findViewById(android.R.id.content));
         }
-        if (placer instanceof FrameLayout) {
-            // Honeycomb or later.
-            placer.addView(keyPreview, new FrameLayout.LayoutParams(0, 0));
-        } else {
-            // Gingerbread or ealier.
-            placer.addView(keyPreview, new LinearLayout.LayoutParams(0, 0));
-        }
+        final ViewGroup placer = mPreviewPlacer;
+        placer.addView(keyPreview, FrameLayoutCompatUtils.newLayoutParam(placer, 0, 0));
     }
 
     // TODO: Introduce minimum duration for displaying key previews
diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java
index fa27ca5..09b356d 100644
--- a/java/src/com/android/inputmethod/latin/CandidateView.java
+++ b/java/src/com/android/inputmethod/latin/CandidateView.java
@@ -44,6 +44,7 @@
 import android.widget.PopupWindow;
 import android.widget.TextView;
 
+import com.android.inputmethod.compat.FrameLayoutCompatUtils;
 import com.android.inputmethod.compat.LinearLayoutCompatUtils;
 import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
 
@@ -244,7 +245,8 @@
     public void setListener(Listener listener, View inputView) {
         mListener = listener;
         mKeyboardView = inputView.findViewById(R.id.keyboard_view);
-        mCandidatesPane = (ViewGroup)inputView.findViewById(R.id.candidates_pane);
+        mCandidatesPane = FrameLayoutCompatUtils.getPlacer(
+                (ViewGroup)inputView.findViewById(R.id.candidates_pane));
         mCandidatesPane.setOnClickListener(this);
         mCandidatesPaneContainer = (ViewGroup)inputView.findViewById(
                 R.id.candidates_pane_container);
@@ -346,12 +348,10 @@
                 }
                 if (x != 0) {
                     final View divider = mDividers.get(i - NUM_CANDIDATES_IN_STRIP);
-                    mCandidatesPane.addView(divider);
-                    placeCandidateAt(divider, x, y);
+                    addCandidateAt(divider, x, y);
                     x += dividerWidth;
                 }
-                mCandidatesPane.addView(tv);
-                placeCandidateAt(tv, x, y);
+                addCandidateAt(tv, x, y);
                 x += width;
             }
 
@@ -372,14 +372,13 @@
         }
     }
 
-    private void placeCandidateAt(View v, int x, int y) {
-        ViewGroup.LayoutParams lp = v.getLayoutParams();
-        if (lp instanceof ViewGroup.MarginLayoutParams) {
-            ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams)lp;
-            mlp.width = v.getMeasuredWidth();
-            mlp.height = v.getMeasuredHeight();
-            mlp.setMargins(x, y + (mCandidateStripHeight - mlp.height) / 2, 0, 0);
-        }
+    private void addCandidateAt(View v, int x, int y) {
+        final int width = v.getMeasuredWidth();
+        final int height = v.getMeasuredHeight();
+        final MarginLayoutParams marginLayoutParams = FrameLayoutCompatUtils.newLayoutParam(
+                mCandidatesPane, width, height);
+        marginLayoutParams.setMargins(x, y + (mCandidateStripHeight - height) / 2, 0, 0);
+        mCandidatesPane.addView(v, marginLayoutParams);
     }
 
     private void centeringCandidates(int from, int to, int width, int paneWidth) {
