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 below possible conditions
m_PopupWindow.Focusable = true;
m_PopupWindow.SoftInputMode = SoftInput.StateVisible;
m_PopupWindow.OutsideTouchable=(true);
m_PopupWindow.Touchable=(true);
m_PopupWindow.Update();
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.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:background="@drawable/popupBorder"
android:focusableInTouchMode="true"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:orientation="vertical"
android:gravity="center_horizontal">
<Spinner
android:id="@+id/spinner"
android:gravity="center_horizontal"
android:layout_width="328dp"
android:minWidth="15dp"
android:layout_height="wrap_content"
style="@style/mySpinnerItemStyle"
android:background="@drawable/bg_spinner"
android:layout_marginTop="40dp"/>
<android.support.design.widget.TextInputLayout
android:id="@+id/txtUserName"
android:layout_width="328dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
>
<android.support.design.widget.TextInputEditText
android:id="@+id/userNameEditText"
android:layout_width="328dp"
android:layout_height="wrap_content"
android:textIsSelectable ="true"
android:focusable="true"
android:imeActionLabel="Done"
android:singleLine="true"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/txtPassword"
android:layout_width="328dp"
android:layout_height="wrap_content"
app:passwordToggleEnabled="true"
app:passwordToggleTintMode="src_atop"
app:passwordToggleTint="@drawable/selector_password_visibility_toggle"
app:passwordToggleDrawable="@drawable/ibk_visible"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_marginTop="16dp"
android:layout_marginBottom="20dp">
<android.support.design.widget.TextInputEditText
android:id="@+id/PasswordEditText"
android:layout_width="328dp"
android:layout_height="wrap_content"
android:imeActionLabel="Done"
android:singleLine="true"
android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
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);
};