How to change color of arrow of expandableListView? [closed]
Asked Answered
G

1

7

How to change the color of the drop-down arrow of an expandable ListView?

It would be better to just change color with, so animation isn't lost.

Gilberte answered 27/8, 2015 at 16:13 Comment(11)
Make your own style/theme.Unprecedented
But I don't know which tag change this colorGilberte
You can use the icons from an older theme (I assume you know where to take the android graphic resources) and copy them to your drawable folders. You can also elaborate them in a Graphic Editor (Gimp, Photoshop, Paint.NET, ...). Nothing complicate.Unprecedented
What does this mean?Unprecedented
I have alredy used icons but it display not goodGilberte
Then re-read my above comment - if you properly use Android's icons, the results will be great. If not, then I guess you are confused about supporting different densities.Unprecedented
I can't take this images - I don't know where they placedGilberte
In Windows, they are in Drive_Letter:\Your_IDE_Install_Path\sdk\platforms\android-*\data\res where * is the API Level number.Unprecedented
Thanks for this idea, i try it. Now i juse need to edit this images) postimg.org/image/675bdl1s9Gilberte
These look like malformed 9 patches. Please ensure that the extension is .9.png, not .pngUnprecedented
Yeah! It helped me! Thank you man!)Gilberte
D
9

Unfortunately everything I've seen says that you need to use a custom drawable, like so

<ExpandableListView 
    android:id="@+id/expandableList"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:groupIndicator="@drawable/custom_expandable" />

Then in custom_expandable.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/up_arrow" 
        android:state_empty="true" />
    <item android:drawable="@drawable/down_arrow" 
        android:state_expanded="true" />
</selector>
Depth answered 27/8, 2015 at 16:18 Comment(10)
I use it, but it's display not good. Like in this picture: i.sstatic.net/HU0J8.pngGilberte
Try giving the TextView a margin on the right: android:layout_marginRight="?android:attr/expandableListPreferredItemPaddingRight" Depth
I tried it, but take this( postimg.org/image/genbdwq0lGilberte
I'm confused. In the first image, they were on the right side, now they are on the left. What are you trying to achieve? Do you still want to change the color? Or are you concerned that they look pixelated?Depth
Sory) First image it's example from internet(i take the same issue). Second image is mine. I want change color without drawable resources or create this resource fineGilberte
To achieve this, you need to make your own images. You can use a tool like this to easily resize them to support multiple screen sizes: romannurik.github.io/AndroidAssetStudio/…Depth
I used icons from this place: google.com/design/icons There all standart sizes. But I will try use other sizesGilberte
Did you put each image in it's respective drawable folder? (eg: drawable-hdpi, drawable-xhdpi, drawable-xxhdpi)Depth
Yes, I did, but u saw resultGilberte
its late but for anyone like me who used this ans, put icon in a layer-list to stop them from pixlating like this--> <layer-list xmlns:android="schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <size android:width="@dimen/value_24dp" android:height="@dimen/value_24dp"/> </shape> </item> <item android:drawable="@drawable/ic_expandable_arrow_down" android:height="@dimen/value_18dp" android:width="@dimen/value_18dp" android:gravity="center"/> </layer-list>Sharronsharyl

© 2022 - 2024 — McMap. All rights reserved.