I have group indication with small icon, and i use groupIndicator to call the selector to draw it but I see android by default stretch that icon to fits the text size
how can i prevent that behavior, and display the icon with it's original size ?
Whatever image you are using as your group indicator, make it a 9 patch (xxx.9.png) image and set its stretchable areas to around the border pixels (which probably may be transparent). It will prevent stretching of image from the middle.
<ExpandableListView
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="@+id/elv_store_info_Expandlist"
android:cacheColorHint="#FFFFFF"
android:overScrollMode="never"
android:fastScrollEnabled="false"
android:fastScrollAlwaysVisible="false"
android:indicatorRight="20dp"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:groupIndicator="@drawable/store_info_expandabellist_indicator"
/>
@store_info_expandabellist_indicator.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_empty="true" android:drawable="@drawable/bitmap_btn_arraw_right_dark_small">
</item>
<item android:state_expanded="true" android:drawable="@drawable/bitmap_btn_arraw_bottom_white_small">
</item>
<item android:drawable="@drawable/bitmap_btn_arraw_right_dark_small">
</item>
</selector>
@bitmap_btn_arraw_right_dark_small
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:left="11dp"
android:right="11dp"
android:top="12dp"
android:bottom="12dp"
android:drawable="@drawable/btn_arrowright_dark">
</item>
</layer-list>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With