Disable Button click sound in android
AndroidAndroid Problem Overview
How to disable click sound of a particular button in Android app?
Here is my code:
more1after.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
sc.scrollTo(sc.getScrollX() + 75,
sc.getScrollY() + sc.getWidth() + 5);
}
});
Android Solutions
Solution 1 - Android
Try this code for disable button click sound effect:
yourbutton.setSoundEffectsEnabled(false);
(or) Layout XML file
<Button... android:soundEffectsEnabled="false"/>
Solution 2 - Android
In case anyone wonders, here is the XML way:
<Button
...
android:soundEffectsEnabled="false" />
Solution 3 - Android
For those who write code in Kotlin.
button.isSoundEffectsEnabled = false
Solution 4 - Android
<Button
......
android:soundEffectsEnabled="false"/>
Java code
button = findViewbyId(R.id.YourBUttonID);
button.setSoundEffectsEnabled(false);