diff --git a/README.md b/README.md index cf4e1ee..1c58aa2 100644 --- a/README.md +++ b/README.md @@ -64,10 +64,10 @@ Now, you have successfully created some TagViews. The following will show some m | container_max_lines | integer | The max lines for TagContainerLayout(default 0, auto increase) | tag_border_width | dimension | TagView Border width(default 0.5dp) | tag_corner_radius | dimension | TagView Border radius(default 15.0dp) -| tag_horizontal_padding | dimension | Horizontal padding for TagView, include left and right padding(left and right padding are equal, default 20px) -| tag_vertical_padding | dimension | Vertical padding for TagView, include top and bottom padding(top and bottom padding are equal, default 17px) +| tag_horizontal_padding | dimension | Horizontal padding for TagView, include left and right padding(left and right padding are equal, default 10dp) +| tag_vertical_padding | dimension | Vertical padding for TagView, include top and bottom padding(top and bottom padding are equal, default 8dp) | tag_text_size | dimension | TagView Text size(default 14sp) -| tag_bd_distance | dimension | The distance between baseline and descent(default 5.5px) +| tag_bd_distance | dimension | The distance between baseline and descent(default 2.75dp) | tag_text_color | color | TagView text color(default #FF666666) | tag_border_color | color | TagView border color(default #88F44336) | tag_background_color | color | TagView background color(default #33F44336) diff --git a/androidtagview/src/main/java/co/lujun/androidtagview/TagContainerLayout.java b/androidtagview/src/main/java/co/lujun/androidtagview/TagContainerLayout.java index 170d894..9cc9589 100644 --- a/androidtagview/src/main/java/co/lujun/androidtagview/TagContainerLayout.java +++ b/androidtagview/src/main/java/co/lujun/androidtagview/TagContainerLayout.java @@ -72,11 +72,11 @@ public class TagContainerLayout extends ViewGroup { /** Text direction(support:TEXT_DIRECTION_RTL & TEXT_DIRECTION_LTR, default TEXT_DIRECTION_LTR)*/ private int mTagTextDirection = View.TEXT_DIRECTION_LTR; - /** Horizontal padding for TagView, include left & right padding(left & right padding are equal, default 20px)*/ - private int mTagHorizontalPadding = 20; + /** Horizontal padding for TagView, include left & right padding(left & right padding are equal, default 10dp)*/ + private int mTagHorizontalPadding = 10; - /** Vertical padding for TagView, include top & bottom padding(top & bottom padding are equal, default 17px)*/ - private int mTagVerticalPadding = 17; + /** Vertical padding for TagView, include top & bottom padding(top & bottom padding are equal, default 8dp)*/ + private int mTagVerticalPadding = 8; /** TagView border color(default #88F44336)*/ private int mTagBorderColor = Color.parseColor("#88F44336"); @@ -102,8 +102,8 @@ public class TagContainerLayout extends ViewGroup { /** TagView drag state(default STATE_IDLE)*/ private int mTagViewState = ViewDragHelper.STATE_IDLE; - /** The distance between baseline and descent(default 5.5px)*/ - private float mTagBdDistance = 5.5f; + /** The distance between baseline and descent(default 2.75dp)*/ + private float mTagBdDistance = 2.75f; /** OnTagClickListener for TagView*/ private TagView.OnTagClickListener mOnTagClickListener; @@ -176,7 +176,7 @@ private void init(Context context, AttributeSet attrs, int defStyleAttr){ mBorderRadius = attributes.getDimension(R.styleable.AndroidTagView_container_border_radius, dp2px(context, mBorderRadius)); mTagBdDistance = attributes.getDimension(R.styleable.AndroidTagView_tag_bd_distance, - mTagBdDistance); + dp2px(context, mTagBdDistance)); mBorderColor = attributes.getColor(R.styleable.AndroidTagView_container_border_color, mBorderColor); mBackgroundColor = attributes.getColor(R.styleable.AndroidTagView_container_background_color, @@ -193,9 +193,10 @@ private void init(Context context, AttributeSet attrs, int defStyleAttr){ mTagBorderRadius = attributes.getDimension( R.styleable.AndroidTagView_tag_corner_radius, dp2px(context, mTagBorderRadius)); mTagHorizontalPadding = (int) attributes.getDimension( - R.styleable.AndroidTagView_tag_horizontal_padding, mTagHorizontalPadding); + R.styleable.AndroidTagView_tag_horizontal_padding, + dp2px(context, mTagHorizontalPadding)); mTagVerticalPadding = (int) attributes.getDimension( - R.styleable.AndroidTagView_tag_vertical_padding, mTagVerticalPadding); + R.styleable.AndroidTagView_tag_vertical_padding, dp2px(context, mTagVerticalPadding)); mTagTextSize = attributes.getDimension(R.styleable.AndroidTagView_tag_text_size, sp2px(context, mTagTextSize)); mTagBorderColor = attributes.getColor(R.styleable.AndroidTagView_tag_border_color,