Reputation: 449
I have added a few chips in my app. The default chip have tick icon when you select it like this.
I want to change the icon position to the bottom. Like this.
There is no property to change the icon position. How can I achieve this result.
Upvotes: 0
Views: 3854
Reputation: 86
You can utilize the closeIcon
properties since it already on the right side of the chip. something like this:
<com.google.android.material.chip.Chip
android:id="@+id/customerListChipSort"
style="@style/MyChip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sort"
android:textStyle="bold"
app:closeIcon="@drawable/ic_dropdown"
app:closeIconEnabled="true"
app:closeIconSize="@dimen/dimens_12dp"
app:closeIconTint="@color/observatory_green" />
Upvotes: 0
Reputation: 196
Start icon
app:chipIconVisible
— visibility of the chip icon.
app:chipIcon
— drawable icon to show at the start of the chip.
app:chipIconSize
— size of the chip icon.
chip.setOnClickListener {
// Handle chip click
}
close icon
app:closeIconVisible
— visibility of the close icon.
app:closeIcon
— drawable icon show at end of the chip.
app:closeIconSize
— size of the close icon.
chip.setOnCloseIconClickListener {
// Handle chip close icon click
}
Upvotes: 0
Reputation: 1
You could set android:layoutDirection="rtl"
or the opposite of your current direction to put the icon on the right.
For more: https://material.io/design/usability/bidirectionality.html
Upvotes: 0
Reputation: 49
use this property to change chip icon position:
android:layoutDirection="rtl"
Upvotes: 1