Reputation: 7264
I want to have an onTouch effect like the Home Button on Android 3.0+.
Is there a property to do so easily? Or I have to do it all myself? And how?
Thanks!
UPDATE: Here is the screenshot: https://i.sstatic.net/QrCrd.jpg I would like to have the same blue, circle, fade-out effect.
Upvotes: 0
Views: 487
Reputation: 30804
What you're talking about is called the Navigation Bar. The animation and circle effect used when you touch a button are from a custom class that's extending ImageView
.
You can view the full source for that class here.
As far as the Holo blue color goes, you can visit the Android Design Guidelines - Color section to look at all of the colors used in Ice Cream Sandwich. Move your mouse over a specific color in the palette to learn the corresponding hex value.
I'll leave this example here in case you decide not to use the KeyButtonView
class.
Holo selector example:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:drawable="@color/holo_blue_dark" android:state_pressed="true"/>
<item android:drawable="@color/holo_blue_dark" android:state_enabled="true" android:state_focused="true"/>
<item android:drawable="@color/transparent"/>
</selector>
Upvotes: 2