Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

TextInputEditText in android popup window not getting focus

i have a spinner and 2 TextInputEditText inside a linear layout.

inside a fragment i added this layout to the popup window. for spinner i added a custom adapter with image and text. the TextInputEditText are not getting focus, i tried all the possible ways.

tried with some possible conditions

and also tried getting the keypad to focus with TextInputEditText click event, with this able to open the keypad but the TextInputEditText is not getting the focus.

View objPopupview = LayoutInflater.From(ViewGroup.Context).Inflate(Resource.Layout.AddAccountTabPage, null);
            m_PopupWindow = new PopupWindow(objPopupview, LayoutParams.WrapContent, LayoutParams.WrapContent, true);
            m_PopupWindow.Focusable = true;
             m_PopupWindow.SoftInputMode = SoftInput.StateVisible;
            m_PopupWindow.OutsideTouchable=(true);
            m_PopupWindow.Touchable=(true);
            m_PopupWindow.Update();

 txtUserNameEditBox.Click += delegate
                {
                    txtUserNameEditBox.RequestFocus();
                    txtUserName.RequestFocus();
                    txtUserName.FocusableInTouchMode = true;
                    InputMethodManager imm = (InputMethodManager)ViewGroup.Context.GetSystemService(Context.InputMethodService);
                    imm.ShowSoftInput(txtUserName, ShowFlags.Forced);
                    imm.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
                };

Answers

  • JarvanJarvan Member, Xamarin Team Xamurai

    Try to set requestFocus to EditText.

Sign In or Register to comment.