pchmn / MaterialChipsInput

Implementation of Material Design Chips component for Android
Apache License 2.0
2.63k stars 383 forks source link

ChipView not displayed properly #48

Open RiteshChandnani opened 7 years ago

RiteshChandnani commented 7 years ago

Hi there,

The chip is not displayed properly when the label text is too long.

screenshot_20170726-151739

Thanks.

LunevNF commented 5 years ago

I have the same problem (using last version). https://github.com/pchmn/MaterialChipsInput/pull/43 not helps me. So, the solution is:

LinearLayout.LayoutParams chipLabelParams = new LinearLayout.LayoutParams(
        ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT, 1f);
chipLabelParams.setMargins(0,8,0,0);
chipLabel.setLayoutParams(chipLabelParams);
chipLabel.setGravity(View.TEXT_ALIGNMENT_CENTER);
chipLabel.setMaxLines(1);
chipLabel.setEllipsize(TextUtils.TruncateAt.END);