我有一个位于
**Fragment**
中的 **EditText**
。
当键盘弹出时,布局不会改变。
我尝试了以下所有选项,但都没有起作用。
我在stackoverflow上阅读了所有相关主题,但未找到解决方法。
如果有其他想法,请分享。
我尝试过的选项:
<activity android:windowSoftInputMode="adjustPan"> </activity>
<activity android:windowSoftInputMode="adjustPan|adjustResize">
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
android:windowSoftInputMode="stateVisible|adjustResize"
以下是我的Layout
的XML
代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layoutDirection="rtl"
tools:background="@mipmap/bg">
<RelativeLayout
android:id="@+id/contactUsSaperator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_toLeftOf="@+id/gcontactUsHeader"
android:background="#ffffff" />
<TextView
android:id="@+id/gcontactUsHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="@string/contactUs"
android:textColor="#ffffff" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_toRightOf="@+id/gcontactUsHeader"
android:background="#ffffff" />
</RelativeLayout>
<LinearLayout
android:id="@+id/contactUsOpenHour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@id/contactUsSaperator"
android:layout_marginTop="17dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/contactUsOpenHourText"
android:textColor="@color/blueTextColor"
android:textStyle="bold"
android:textSize="16dp"
android:layout_marginRight="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/contactUsOpenHourTuesdayWednesday"
android:textColor="@color/blueTextColor"
android:textSize="15dp"
android:layout_marginRight="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/contactUsOpenHourThursday"
android:textColor="@color/blueTextColor"
android:textSize="15dp"
android:layout_marginRight="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/contactUsOpenHourFriday"
android:textColor="@color/blueTextColor"
android:textSize="15dp"
android:layout_marginRight="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:text="@string/contactUsOpenHourPhone"
android:textColor="@color/blueTextColor"
android:textStyle="bold"
android:textSize="16dp"
android:layout_marginRight="10dp"
/>
<FrameLayout
android:layout_marginTop="25dp"
android:layout_width="wrap_content"
android:layout_height="150dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="150dp"
android:background="@mipmap/contact_us_tex_fild"
android:scaleType="fitXY"
/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="3dp"
>
<EditText
android:id="@+id/contactUsEditText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="@string/contactHint"
android:textSize="15dp"
android:textColor="@color/blueTextColor"
android:textColorHint="@color/blueTextColor"
android:inputType="text"
/>
</ScrollView>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
>
<ImageView
android:id="@+id/contactUsSendButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/button"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/contacUsSendButton"
android:layout_gravity="center"
android:textColor="@color/blueTextColor"
android:textSize="22dp"
android:textStyle="bold"
/>
</FrameLayout>
</LinearLayout>
</LinearLayout>