微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在Android中打开键盘时在视图中滚动?

我在scrollview中有一些edittext,当它们超出屏幕容量时,当键盘打开时很难执行平滑滚动.这是我的代码.

     <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>

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

谢谢

解决方法:

使用

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

在线性布局内.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐