I have got a cool image (fancy with rounded corners). I want to implement that image in my android app. When clicked on it, I want it to darken a bit (like a button when pressed) and launch a new activity.
How can I do that and what should I use (ImageView, ImageButton or just Button) ?
You’ll require two version of your cool image call it as active.png (clicked state i.e darken a bit) and inactive.png (normal state).
in the
drawablefolder create a Selector file for them as followsLike :
/drawable/cool_button_selector.xmland then user the ImageButton like this:
Added: android:background=”@null” to
<ImageButton>Hope this helps 🙂