aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/res/layout-xlarge/candidates.xml7
-rw-r--r--java/res/layout/candidates.xml5
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java19
3 files changed, 20 insertions, 11 deletions
diff --git a/java/res/layout-xlarge/candidates.xml b/java/res/layout-xlarge/candidates.xml
index 9d6cd241c..096a0adf1 100644
--- a/java/res/layout-xlarge/candidates.xml
+++ b/java/res/layout-xlarge/candidates.xml
@@ -32,14 +32,14 @@
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
- android:layout_height="@dimen/candidate_strip_height"
+ android:layout_height="wrap_content"
android:background="@drawable/keyboard_suggest_strip_holo"
android:paddingRight="@dimen/candidate_strip_padding"
android:paddingLeft="@dimen/candidate_strip_padding"
>
<HorizontalScrollView
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:fadingEdge="horizontal"
android:fadingEdgeLength="@dimen/candidate_strip_fading_edge_length"
android:scrollbars="none"
@@ -47,7 +47,8 @@
<com.android.inputmethod.latin.CandidateView
android:id="@+id/candidates"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="@dimen/candidate_strip_height"
+ android:gravity="center_vertical" />
</HorizontalScrollView>
</LinearLayout>
</LinearLayout>
diff --git a/java/res/layout/candidates.xml b/java/res/layout/candidates.xml
index 39e39a1b7..3d91c1d20 100644
--- a/java/res/layout/candidates.xml
+++ b/java/res/layout/candidates.xml
@@ -30,7 +30,7 @@
>
<HorizontalScrollView
android:layout_width="match_parent"
- android:layout_height="@dimen/candidate_strip_height"
+ android:layout_height="wrap_content"
android:background="@drawable/keyboard_suggest_strip"
android:fadingEdge="horizontal"
android:fadingEdgeLength="@dimen/candidate_strip_fading_edge_length"
@@ -39,6 +39,7 @@
<com.android.inputmethod.latin.CandidateView
android:id="@+id/candidates"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="@dimen/candidate_strip_height"
+ android:gravity="center_vertical" />
</HorizontalScrollView>
</LinearLayout>
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 71863803b..dee191352 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -47,6 +47,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
+import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
@@ -908,10 +909,18 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
if (mPreviewText.getParent() == null) {
final FrameLayout screenContent = (FrameLayout) getRootView()
.findViewById(android.R.id.content);
- screenContent.addView(mPreviewText, new FrameLayout.LayoutParams(0, 0));
+ if (android.os.Build.VERSION.SDK_INT >= /* HONEYCOMB */ 11) {
+ screenContent.addView(mPreviewText, new FrameLayout.LayoutParams(0, 0));
+ } else {
+ // Insert LinearLayout to be able to setMargin because pre-Honeycomb FrameLayout
+ // could not handle setMargin properly.
+ final LinearLayout placer = new LinearLayout(getContext());
+ screenContent.addView(placer);
+ placer.addView(mPreviewText, new LinearLayout.LayoutParams(0, 0));
+ }
}
- Key key = tracker.getKey(keyIndex);
+ final Key key = tracker.getKey(keyIndex);
// If keyIndex is invalid or IME is already closed, we must not show key preview.
// Trying to show preview PopupWindow while root window is closed causes
// WindowManager.BadTokenException.
@@ -943,10 +952,8 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
+ mPreviewText.getPaddingLeft() + mPreviewText.getPaddingRight());
final int popupHeight = mPreviewHeight;
final ViewGroup.LayoutParams lp = mPreviewText.getLayoutParams();
- if (lp != null) {
- lp.width = popupWidth;
- lp.height = popupHeight;
- }
+ lp.width = popupWidth;
+ lp.height = popupHeight;
int popupPreviewX = keyDrawX - (popupWidth - keyDrawWidth) / 2;
int popupPreviewY = key.mY - popupHeight + mPreviewOffset;