Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/185.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用android软键盘滚动编辑文本_Android_Android Manifest_Android Scrollview - Fatal编程技术网

使用android软键盘滚动编辑文本

使用android软键盘滚动编辑文本,android,android-manifest,android-scrollview,Android,Android Manifest,Android Scrollview,嗨,我有注册页面&我在滚动视图中使用,但当页面显示为软键底部时,所有字段都隐藏,我希望在键盘出现时也滚动该字段。我在manifest.xml中使用了'adjustPan'或多重组合,但它不起作用。请帮助我如何使用键盘滚动。这是我的代码 manifest.xml <activity android:label="Registration" android:name="Registration" android:windowSoftInputMode="adjustPan"> &l

嗨,我有注册页面&我在滚动视图中使用,但当页面显示为软键底部时,所有字段都隐藏,我希望在键盘出现时也滚动该字段。我在manifest.xml中使用了'adjustPan'或多重组合,但它不起作用。请帮助我如何使用键盘滚动。这是我的代码

manifest.xml

<activity android:label="Registration" android:name="Registration"  
 android:windowSoftInputMode="adjustPan">
</activity> 

我的布局

  <?xml version="1.0" encoding="utf-8"?>
        <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/scrollView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:fillViewport="true" >
      <TableLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <TableRow
            android:gravity="center"
            android:paddingTop="10px" >

            <TextView
                android:id="@+id/status"
                android:layout_width="wrap_content"
                android:layout_gravity="center"
                android:layout_span="2"
                android:text="Registration Form"
                android:textColor="#000000"
                android:textSize="15sp"/>
         </TableRow>

              <TableRow android:layout_marginTop="20dip" >

            <TextView
                android:id="@+id/firstName1"
                android:layout_width="wrap_content"
                android:layout_marginLeft="20dip"
                android:textColor="#000000"
                android:textSize="15sp" />

            <EditText
                android:id="@+id/firstName"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:layout_marginRight="20dip"
                android:layout_weight="1"
                android:inputType="text"
                android:singleLine="true"
                android:maxLength="100"
                android:textColor="#000000"
                android:textSize="15sp" >

                <requestFocus />
            </EditText>
         </TableRow>

         <TableRow android:layout_marginTop="20dip" >

            <TextView
                android:id="@+id/middleName1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:text=" Middle Name :"
                android:textColor="#000000"
                android:textSize="15sp" />

            <EditText
                android:id="@+id/middleName"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:layout_marginRight="20dip"
                android:layout_weight="1" 
                android:inputType="text"
                android:singleLine="true"
                android:maxLength="100"
                android:textColor="#000000"
                android:textSize="15sp"/>
        </TableRow>

           <TableRow android:layout_marginTop="20dip" >

            <TextView
                android:id="@+id/lastName1"
                android:layout_width="wrap_content"
                android:layout_marginLeft="20dip"
                android:textColor="#000000"
                android:textSize="15sp"/>

            <EditText
                android:id="@+id/lastName"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:layout_marginRight="20dip"
                android:layout_weight="1"
                android:inputType="text"
                android:singleLine="true"
                android:maxLength="100"
                android:textColor="#000000"
                android:textSize="15sp" >


            </EditText>
        </TableRow>

        <TableRow android:layout_marginTop="20dip" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:text=" ITS Id(Optional) :"
                android:textColor="#000000"
                android:textSize="15sp" />

            <EditText
                android:id="@+id/itsId"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:layout_marginRight="20dip"
                android:layout_weight="1"
                android:inputType="number"
                android:maxLength="8" />

        </TableRow>
        <TableRow android:layout_marginTop="20dip" >

            <TextView
                android:id="@+id/userName1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:textColor="#000000"
                android:textSize="15sp" />

            <EditText
                android:id="@+id/userName"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:layout_marginRight="20dip"
                android:layout_weight="1"
                android:inputType="text" 
                android:singleLine="true"
                android:maxLength="50"
                android:textColor="#000000"
                android:textSize="15sp"/>

        </TableRow>


        <TableRow android:layout_marginTop="20dip" >

            <TextView
                android:id="@+id/password1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:textColor="#000000"
                android:textSize="15sp"/>

            <EditText
                android:id="@+id/password"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:layout_marginRight="20dip"
                android:layout_weight="1"
                android:inputType="textPassword"
                android:maxLength="8"
                android:textColor="#000000"
                android:textSize="15sp" />

        </TableRow>


        <TableRow android:layout_marginTop="20dip" >

            <TextView
                android:id="@+id/confirmPassword1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:textColor="#000000"
                android:textSize="15sp" />

            <EditText
                android:id="@+id/confirmPassword"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:layout_marginRight="20dip"
                android:layout_weight="1"
                android:inputType="textPassword"
                android:maxLength="8"
                android:textColor="#000000"
                android:textSize="15sp" />

        </TableRow>


        <TableRow android:layout_marginTop="20dip" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:text=" Email :"
                android:textColor="#000000"
                android:textSize="15sp" />

            <EditText
                android:id="@+id/email"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:layout_marginRight="20dip"
                android:layout_weight="1"
                android:singleLine="true"
                android:inputType="textEmailAddress"
                android:maxLength="200"
                android:textColor="#000000"
                android:textSize="15sp" />

        </TableRow>

        <TableRow android:layout_marginTop="20dip" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:text=" Gender :"
                android:textColor="#000000"
                android:textSize="15sp" />

            <Spinner
                android:id="@+id/gender"
                android:layout_height="wrap_content"
                 android:layout_marginLeft="20dip"
                android:layout_marginRight="20dip"
                android:layout_weight="1"
                android:entries="@array/gender_array" />

        </TableRow>
       <TableRow android:layout_marginTop="20dip" >


            <CheckBox
                android:id="@+id/profile"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dip"
                android:textColor="#000000"
                android:textSize="15sp"
                android:text="Keep Private" />



        </TableRow>

        <TableRow android:layout_marginTop="20dip" >


            <Button
                android:id="@+id/save"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:clickable="true"
                android:onClick="addNewProfile"
                android:text="Submit" />


             <Button
                android:id="@+id/cancel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:clickable="true"
                android:onClick="cancelActivity"
                android:text="Cancel" />

          </TableRow>
         </TableLayout>
        </ScrollView>

将此添加到您的活动中

<activity android:name="YourActivity" 
          android:windowSoftInputMode="adjustResize" />

您也可以通过此链接了解更多信息