user1910290
user1910290

Reputation: 537

No tap sound on button click - android

I am not getting the sound which is generally heard when a user taps on any ui element Button in Android.

heres my button xml

<Button
    android:id="@+id/continue_btn"
    android:layout_width="280dp"
    android:layout_height="45dp"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="82dp"
    android:background="@drawable/continue_btn_bg"
    android:shadowColor="#000000"
    android:shadowDx="-1"
    android:shadowDy="-1"
    android:shadowRadius="2"
    android:text="CONTINUE"
    android:textSize="20sp" />

the sound just doesn't come when I press this button. Touch Sounds are enabled in android settings.

Upvotes: 2

Views: 1504

Answers (2)

Chris8447
Chris8447

Reputation: 306

I experienced that the system will play the sound automatically once you have attached any action. For example "onClick" in xml.

Upvotes: 0

stinepike
stinepike

Reputation: 54682

use button.playSoundEffect(SoundEffectConstants.CLICK);

Upvotes: 4

Related Questions