3

我在scrollview中有一些edittext,当它们超过屏幕容量时,当键盘打开时很难执行平滑滚动。这里是我的代码。如何在android中打开小键盘的同时滚动视图?

 <ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    > 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
    > 
     <EditText 
      android:layout_width="200dp" 
      android:layout_height="wrap_content" 
      /> 
     <EditText 
      android:layout_width="200dp" 
      android:layout_height="wrap_content" 
      /> 
     <EditText 
      android:layout_width="200dp" 
      android:layout_height="wrap_content" 
      /> 
     <EditText 
      android:layout_width="200dp" 
      android:layout_height="wrap_content" 
      /> 
     <EditText 
      android:layout_width="200dp" 
      android:layout_height="wrap_content" 
      /> 
    </LinearLayout> 
</ScrollView> 

请指导我一个很好的链接到这个问题或回答相同的,如果有人知道。

感谢

回答

2

使用

android:focusable="true" 
     android:focusableInTouchMode="true" 

内的LinearLayout。

3

android:windowSoftInputMode="adjustResize"放在清单文件中的活动标签上。

它会工作。

相关问题