diff --git a/library/src/main/java/com/doodle/android/chips/ChipsView.java b/library/src/main/java/com/doodle/android/chips/ChipsView.java index 12c3dbf..0babade 100644 --- a/library/src/main/java/com/doodle/android/chips/ChipsView.java +++ b/library/src/main/java/com/doodle/android/chips/ChipsView.java @@ -212,8 +212,9 @@ private void init() { mEditText.requestFocus(); Resources r = getResources(); - int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics()); - mEditText.setPadding(px, px, px, 0); + int px8 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics()); + int px12 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, r.getDisplayMetrics()); + mEditText.setPadding(px8, px12, px8, 0); //mEditText.setLineSpacing(1.0f, 1.0f); addView(mEditText); @@ -239,7 +240,7 @@ public void onClick(View v) { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { - unSelectChipsExcept(null); + //unSelectChipsExcept(null); } } }); @@ -311,7 +312,7 @@ public void run() { } RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - params.topMargin = (int) (textLineParams.row * (CHIP_HEIGHT * mDensity) + textLineParams.row * (TEXT_EXTRA_TOP_MARGIN * mDensity)); + params.topMargin = (int) ((textLineParams.row * ((CHIP_HEIGHT * mDensity)) + (textLineParams.row * (TEXT_EXTRA_TOP_MARGIN * mDensity)))); mEditText.setLayoutParams(params); addLeadingMarginSpan(textLineParams.lineMargin); if (moveCursor) { diff --git a/library/src/main/java/com/doodle/android/chips/views/ChipsVerticalLinearLayout.java b/library/src/main/java/com/doodle/android/chips/views/ChipsVerticalLinearLayout.java index 0fa4aa4..9eed34b 100644 --- a/library/src/main/java/com/doodle/android/chips/views/ChipsVerticalLinearLayout.java +++ b/library/src/main/java/com/doodle/android/chips/views/ChipsVerticalLinearLayout.java @@ -63,7 +63,7 @@ public TextLineParams onChipsChanged(List chips) { Resources r = getResources(); int px8 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics()); MarginLayoutParams mlp = (MarginLayoutParams) view.getLayoutParams(); - mlp.setMargins(0, 0, px8, px8); + mlp.setMargins(0, 0, px8, 0); view.setLayoutParams(mlp); view.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); @@ -93,10 +93,10 @@ public TextLineParams onChipsChanged(List chips) { private LinearLayout createHorizontalView() { Resources r = getResources(); + int px4 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, r.getDisplayMetrics()); int px8 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics()); - int px16 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics()); LinearLayout ll = new LinearLayout(getContext()); - ll.setPadding(px16, 0, 0, (int) (ChipsView.CHIP_BOTTOM_PADDING * mDensity)); + ll.setPadding(0, px8, 0, (int) (ChipsView.CHIP_BOTTOM_PADDING * mDensity)); ll.setOrientation(HORIZONTAL); addView(ll); mLineLayouts.add(ll);