[英]Keyboard pushing edittext content when clicking
Keyboard pushing content of edittext up when I start writing something , already add android:windowSoftInputMode="adjustResize"
in AndroidManifest. 当我开始写东西时,键盘会向上推edittext的内容,已经在AndroidManifest中添加了android:windowSoftInputMode="adjustResize"
。 Please provide solution for this issue. 请提供此问题的解决方案。
Here is my code. 这是我的代码。
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.mouad.fixmyphone.fragment.SendUsFragment"
android:background="#ffff">
<!-- TODO: Update blank fragment layout -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp">
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:layout_below="@id/idtitle"
android:background="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="E-mail :"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="#1A237E"
android:layout_marginTop="90sp"
android:id="@+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:text="SEND"
android:textStyle="bold"
android:layout_width="130sp"
android:layout_height="wrap_content"
android:id="@+id/sendbtn"
android:textColor="#ffffff"
android:background="@drawable/roundshapebtn"
android:layout_marginTop="17dp"
android:layout_below="@+id/msgtext"
android:layout_centerHorizontal="true" />
<EditText
android:background="@drawable/rounded_edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Your Problem in Short"
android:textStyle="bold"
android:id="@+id/msgtext"
android:maxLength="80"
android:maxLines="2"
android:inputType="textMultiLine"
android:layout_below="@+id/textmsgview"
android:layout_alignParentLeft="true"
android:drawableLeft="@drawable/ic_pb"
android:layout_alignParentStart="true"
android:drawablePadding="20dp"
android:paddingLeft="1dp"
android:paddingRight="12dp"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:layout_marginTop="17dp"/>
<EditText
android:background="@drawable/rounded_edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Your E-mail . . ."
android:textStyle="bold"
android:id="@+id/emailtext"
android:inputType="textEmailAddress"
android:drawableLeft="@drawable/ic_email"
android:drawablePadding="20dp"
android:paddingLeft="1dp"
android:paddingRight="12dp"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:layout_below="@+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="17dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tell us your problem :"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="#1A237E"
android:layout_marginTop="20dp"
android:id="@+id/textmsgview"
android:layout_below="@+id/emailtext"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp" />
</RelativeLayout>
it seems like you use adjust_resize for the keyboard, the view will be "resized" to fit your view(i mean layout) if you dont want any resize, change to adjustPan 似乎您在键盘上使用了Adjust_resize,如果您不希望调整大小,则视图将被“调整大小”以适合您的视图(我的意思是布局),请更改为AdjustPan
FYR Difference between adjustResize and adjustPan in android? FYR 在Android中AdjustResize和AdjustPan之间的区别?
Problem solved with ScrollView ScrollView解决的问题
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- Content here -->
</LinearLayout>
</ScrollView>
</LinearLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.