Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regarding Button Clicking in android

Tags:

android

I have an application in Android 2.3.3. There are few buttons in it. I want a functionality (for the buttons) similar to that of qwerty keyboard, where in when we press a key or a letter, that character will be shown for a fraction of a second, just above the place where that character is present in the keyboard.

Do we have any such kind of properties built in?

If there is no such thing, i am using a background color to my buttons and it's hard to get a note of whether the button is clicked or not. Can we somehow make it visible that the button is clicked.

like image 494
Vamsi Challa Avatar asked Mar 24 '26 17:03

Vamsi Challa


1 Answers

Your looking for a selector somehting like this inside your drawable folder. To reference it just call it like a drawable.

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/buttonpressed" />
<item android:drawable="@drawable/buttonnotpressed" /> <!-- default -->
</selector>
like image 197
doubleA Avatar answered Mar 27 '26 07:03

doubleA



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!