Jak Mogę zmienić kolor efektu dotyku na pasku czynności w systemie Android 3.0 i nowszym
Próbuję zmienić kolor efektu rollover po dotknięciu elementu ActionBar. Na moim Galaxy Nexusie z 4.0.2 jest to rodzaj turkusowego cieniowania, które chcę być w innym kolorze.
Dla jasności, mówię tutaj o elementach ActionBar, a nie o zakładkach nawigacji.
Mam go działającego pod biblioteką kompatybilności, ale dla Androida 3.0 i wyższych, czyli "prawdziwego" Actionbara, po prostu nie wiem jak to zrobić.
Czy ktoś wie czy i jak to można to osiągnąć?
23
1 answers
Natywny pasek akcji używa atrybutu theme selectableItemBackground
do rysowania tła elementu akcji. Powinna to być lista stanów, którą można narysować.
Oto deklaracja w Theme.Holo
:
<style name="Theme.Holo">
<!-- bunch of things -->
<item name="android:selectableItemBackground">@android:drawable/item_background_holo_dark</item>
<!-- bunch of things -->
</style>
I jego drawable XML:
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_dark" />
<item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_disabled_holo_dark" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition_holo_dark" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition_holo_dark" />
<item android:state_focused="true" android:drawable="@drawable/list_focused_holo" />
<item android:drawable="@color/transparent" />
</selector>
45
Author: Jake Wharton,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-01-24 19:02:51
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-01-24 19:02:51