Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8783297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:47:45+00:00 2026-06-13T20:47:45+00:00

I have a customized Dialog. Inside the dialog, there’s an EditText. When I touch

  • 0

I have a customized Dialog. Inside the dialog, there’s an EditText. When I touch inside the EditText, the soft keyboard is shown. I want to hide this keyboard when I touch inside the other place of the Dialog.

I know how to hide a keyboard in activity. I just don’t know how to do this in Dialog.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:47:46+00:00Added an answer on June 13, 2026 at 8:47 pm

    You can do that easy by using focuslisners, see my code sample below:

    EditText.setOnFocusChangeListener(new View.OnFocusChangeListener() 
            { 
                @Override 
                public void onFocusChange(View v, boolean hasFocus) 
                { 
                    if (hasFocus) 
                    { 
                        InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); 
                        imm.showSoftInput(EditText, InputMethodManager.SHOW_IMPLICIT); 
                    }
                    else
                    {
                       InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
                       imm.hideSoftInputFromWindow(EditText.getWindowToken(), 0);
                    }
                } 
            });
    

    edit:

    <?xml version="1.0" encoding="utf-8"?>
        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" >
    
                <LinearLayout
                android:id="@+id/wrapper"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:focusable = "true"
                android:isFocusableInTouchMode = "true"
                android:clickable = "true" > 
    
                    <EditText
                    android:id="@+id/EditText"
                    android:layout_width="fill_parent"
                    android:layout_height="50dp"
                    android:hint="hint"
                    android:singleLine="true" />
    
                </LinearLayout>         
        </RelativeLayout>
    

    \to be sure to get focus:

        LinearLayout actionHide = (LinearLayout) findViewById(R.id.wrapper);
            actionHide.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    actionHide.requestFocus(); // use this to trigger the focus listner
                    //or use code below to set the keyboard to hidden
                    InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
                    imm.hideSoftInputFromWindow(EditText.getWindowToken(), 0);
    
                }
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a customized Dialog. In this Dialog, there's one Button and one TextView.
i want to build a customized dialog just like the one shown in image:
I want to have an Android dialog using Fragments that is fully customized: none
I have customized the UIAlertView class. It's working perfectly. I don't want the bounce
I have a customized show/hide toggle script that I'm using along with CSS3 transitions
I have customized a UITableViewCell and I want to implement swipe to delete. But
Possible Duplicate: Dismiss a custom dialog? I have a customized dialog, the layout file
I want to exit my app with an my customized alert dialog showing first
I came across this application, that appeared to have customized the UI Picker. I
I have customized a canvas to support the zooming. I am doing this by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.