Android adjustpan not working after the first time

前端 未结 8 886
生来不讨喜
生来不讨喜 2020-12-01 05:55

My problem: starting from the second time the software keyboard is shown on the screen, it entirely hides my EditText.

Attribute android:windowSoftInputMode=\"adjus

相关标签:
8条回答
  • 2020-12-01 06:51

    In EditText android:layout_gravity="center" Create this type of problem. If you want to text become in center then you can do this way

    Step1: For Layout

     <LinearLayout
                    android:id="@+id/linerPassword"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_toRightOf="@+id/imageView2"
                    android:gravity="center">
    
                    <EditText
                        android:id="@+id/editText2"
                        android:layout_width="wrap_content"
                        android:layout_height="40dp"
                        android:background="@null"
                        android:hint="*****"
                        android:layout_marginLeft="-40dp"
                        android:paddingLeft="10dp"
                        android:paddingRight="10dp"
                        android:inputType="textPassword"
                        android:textColor="@color/white"
                        android:textColorHint="@color/white"
                        android:textSize="18sp" />
                </LinearLayout>
    

    step2: Some thing by programatically

     linerUser.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.showSoftInput(mETUserName, 0);
                mETUserName.requestFocus();    
            }
        });
    

    Finally work very well. I found this solution for adjust softKeyboard

    0 讨论(0)
  • 2020-12-01 06:53

    After Trying many solutions in Manifest file, I solved it by below, adjustPan with Relative layout does not work,

    Your parent Layout has to be LinearLayout

    Hopes this saves some time for people.

    0 讨论(0)
提交回复
热议问题