Forum Xamarin.Android

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

Sign In or Register to comment.