它对于默认 inputType 工作正常,但对于数字,屏幕不会调整大小。我android:windowSoftInputMode="adjustResize"
在清单文件中使用活动。我在表格底部有“邮件 ID”和“手机号”字段。像这样
它适用于邮件 ID..
但是对于手机号码,它是号码字段..
这是我的 xml 文件的一部分...移动号是最后一个带有 inputType 编号的 editTest 字段。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<ScrollView
android:id="@+id/scrollview"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white_smoke"
android:orientation="vertical"
android:paddingBottom="8dp">
<LinearLayout
style="@style/FormItemStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
style="@style/TextFormLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Name*" />
<EditText
android:id="@+id/edt_f_name"
style="@style/EditTextBgStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2.5"
android:inputType="textCapWords|textNoSuggestions" />
</LinearLayout>
.
.
.
.
other view
.
.
<LinearLayout
style="@style/FormItemStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<CheckBox
android:id="@+id/check_adds_same_as_per"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Same as Permanent Address" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
style="@style/TextFormLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Communication Address*" />
<EditText
android:id="@+id/edt_commun_adds"
style="@style/EditTextBgStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2.5"
android:gravity="top"
android:lines="3"
android:maxLines="4"
android:inputType="textMultiLine|textNoSuggestions" />
</LinearLayout>
</LinearLayout>
<LinearLayout
style="@style/FormItemStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
style="@style/TextFormLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Mail ID" />
<EditText
android:id="@+id/edt_mail_id"
style="@style/EditTextBgStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2.5" />
</LinearLayout>
<LinearLayout
style="@style/FormItemStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
style="@style/TextFormLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Mobile No*" />
<EditText
android:id="@+id/edt_mobile_no"
style="@style/EditTextBgStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2.5"
android:inputType="number"
android:maxLength="10" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<include layout="@layout/master_button" />
</LinearLayout>