我试图编写一个代码,用于在软键盘出现时重新调整UI组件的大小。
当我使用adjustResize,它调整UI组件的大小,同时adjustPan给了我相同的输出。
我想知道他们之间的差别,什么时候使用每个组件?哪一个(adjustPan或adjustResize)有助于调整UI大小?
这里是我的xml:
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
android:id="@+id/editText5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="45dp"
android:ems="10"
android:inputType="textPersonName" />
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="40dp"
android:text="My Button" />
和清单文件:
package="com.example.adjustscroll"
android:versionCode="1"
android:versionName="1.0" >
android:minSdkVersion="8"
android:targetSdkVersion="17" />
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
android:name="com.example.adjustscroll.MainActivity"
android:label="@string/app_name"
android:windowSoftInputMode="adjustPan|adjustResize" >
347




被折叠的 条评论
为什么被折叠?



