简体   繁体   中英

Change android chip icon position

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.

use this property to change chip icon position:

android:layoutDirection="rtl"

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

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
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM