Coding⏱️ 2 min read📅 2026-06-03

How to Fix: How do I make an Android EditView 'Done' button and hide the keyboard when clicked?

Android EditView Done button and keyboard hide

Quick Answer: Use the "inputOptions" attribute to add a "done" button to the keyboard, then set the "keyboardType" to "text" to hide it when clicked.

When the user clicks on an EditView, Android opens the keyboard so that the user can write in the EditView.

The problem is, when the user is done writing, there is no way to hide the keyboard. The user has to press the back button to hide the keyboard.

Is there a way to display a Done button on the keyboard that will hide the keyboard?

✅ Adding a Done Button to Hide Keyboard

Method:

  1. Step 1: Add a Button to your layout with the android:imeOptions set to 'actionDone'.

Example Code:

android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Click me to hide keyboard" android:imeOptions="actionDone"

🎯 Final Words

By following these steps, you can add a Done button to your keyboard that will hide the keyboard when clicked.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions