2017-08-04 103 views
0

它对于默认inputType正常工作,但对于数字,屏幕不会调整大小。 我在清单文件中使用android:windowSoftInputMode="adjustResize"进行活动。 我有 '邮件ID',并在form.like底部的 '手机号码' 字段此如果inputType是数字软键盘覆盖edittext字段

enter image description here

它工作正常的邮件ID ..

enter image description here

但对于手机号码是号码字段..

enter image description here

这里我的xml文件的一部分... mobile no是最后有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> 
+0

尝试使用Android:windowSoftInputMode = “adjustSpan” – Akash

+0

你的意思是 “adjustPan” 吧?我已经尝试过也..它不起作用。 –

+0

尝试使用滚动视图进行布局 – Akash

回答

0

而不是android:windowSoftInputMode="adjustResize" 尝试使用android:windowSoftInputMode="adjustPan"Manifest.xml

+0

我试过了..它不起作用。 –

+0

@HarryMad然后'adjustUnspecified'? –

+0

nope ..没有帮助。 –