How to Disable Button in Android Studio
Mohasin-Nawaz091
Posted on September 22, 2024
First Way:
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
view.setEnabled(false);
}
});
Second Way:
public void disable(View v){
v.setEnabled(false);
}
XML Code file:
<Button
android:id="@+id/button"
android:onClick="disable"
android:layout_margin="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button" />
💖 💪 🙅 🚩
Mohasin-Nawaz091
Posted on September 22, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
webdev ⚡🚀 ReactJS, TypeScript, Vite with Redux and TanStack (React Query) In Practice ⚛️
November 13, 2024