不设置android:scrollbars=“none”,可将ScrollView内容滑动至软键盘上方。
如果不需要滚动条的出现,可使用下面方法。
- 布局
android:scrollbars=“none” 去除屏幕右边的滑动条
android:overScrollMode=“never” 去除滑动到顶部和底部时出现的水纹效果
注意:ScrollView只能有一个子View
<?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:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--内容写在这-->
</LinearLayout>
</ScrollView>
</LinearLayout>
- 在AndroidManifest.xml中,对引用该布局的activity添加
android:windowSoftInputMode="adjustResize|stateHidden"