I am using android.support.design.chip.Chip and the problem I get is that when I set the text dynamically by setText("..."), the text wrongly appears by overlapping the icon, but when I set it on the xml file as app:chipText="Hello" it appears correctly.
here you have my code:
activity.java:
Chip x= new Chip(mView);
x.setChipDrawable(ChipDrawable.createFromResource(mView, R.xml.chip_style));
chip_style.xml:
<?xml version="1.0" encoding="utf-8"?>
<chip xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/Widget.MaterialComponents.Chip.Entry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.MaterialComponents.Chip"
app:chipIcon="@drawable/ic_person"/>
---------------------SOLUTION---------------------
Then, the solution was to use Chip method setChipText(CharSequence text)