Fix ragged suggestion strip baseline

Change-Id: I5fa9e2ad0993602e24f436e1d8ad0999209e5180
main
Tadashi G. Takaoka 2011-06-26 02:07:07 +09:00
parent 4f0d290c5d
commit 7fb04fe007
3 changed files with 4 additions and 5 deletions

View File

@ -24,4 +24,5 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minWidth="@dimen/candidate_min_width" android:minWidth="@dimen/candidate_min_width"
android:textSize="@dimen/candidate_text_size" android:textSize="@dimen/candidate_text_size"
android:padding="0dp"
style="?attr/suggestionBackgroundStyle" /> style="?attr/suggestionBackgroundStyle" />

View File

@ -56,7 +56,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:layout_weight="1.0" android:layout_weight="1.0"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:gravity="center_vertical" android:gravity="center_vertical"
> >
<RelativeLayout <RelativeLayout

View File

@ -75,7 +75,6 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
private final ArrayList<TextView> mWords = new ArrayList<TextView>(); private final ArrayList<TextView> mWords = new ArrayList<TextView>();
private final ArrayList<TextView> mInfos = new ArrayList<TextView>(); private final ArrayList<TextView> mInfos = new ArrayList<TextView>();
private final ArrayList<View> mDividers = new ArrayList<View>(); private final ArrayList<View> mDividers = new ArrayList<View>();
private final int mCandidatePadding;
private final int mCandidateStripHeight; private final int mCandidateStripHeight;
private final CharacterStyle mInvertedForegroundColorSpan; private final CharacterStyle mInvertedForegroundColorSpan;
private final CharacterStyle mInvertedBackgroundColorSpan; private final CharacterStyle mInvertedBackgroundColorSpan;
@ -179,14 +178,13 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
mPreviewPopup.setContentView(mPreviewText); mPreviewPopup.setContentView(mPreviewText);
mPreviewPopup.setBackgroundDrawable(null); mPreviewPopup.setBackgroundDrawable(null);
mCandidatePadding = res.getDimensionPixelOffset(R.dimen.candidate_padding);
mCandidateStripHeight = res.getDimensionPixelOffset(R.dimen.candidate_strip_height); mCandidateStripHeight = res.getDimensionPixelOffset(R.dimen.candidate_strip_height);
for (int i = 0; i < MAX_SUGGESTIONS; i++) { for (int i = 0; i < MAX_SUGGESTIONS; i++) {
final TextView word, info; final TextView word, info;
switch (i) { switch (i) {
case 0: case 0:
word = (TextView)findViewById(R.id.word_left); word = (TextView)findViewById(R.id.word_left);
word.setPadding(mCandidatePadding, 0, 0, 0); word.setPadding(res.getDimensionPixelOffset(R.dimen.candidate_padding), 0, 0, 0);
info = (TextView)findViewById(R.id.info_left); info = (TextView)findViewById(R.id.info_left);
break; break;
case 1: case 1:
@ -355,7 +353,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
if (info != null) { if (info != null) {
final int infoWidth = info.getMeasuredWidth(); final int infoWidth = info.getMeasuredWidth();
FrameLayoutCompatUtils.placeViewAt( FrameLayoutCompatUtils.placeViewAt(
info, x + width - infoWidth, y, infoWidth, info.getMeasuredHeight()); info, width - infoWidth, 0, infoWidth, info.getMeasuredHeight());
} }
} else { } else {
// TODO: Handle overflow case. // TODO: Handle overflow case.