当显示键盘时,我希望屏幕上最底部的元素始终可见。
我尝试过的当前实现(下面概述)可以使内容滚动;但是,我未能使滚动视图默认为位于滚动条的底部。
<activity
android:name=".OnboardingActivity"
android:configChanges="orientation"
android:windowSoftInputMode="stateVisible|adjustResize"
android:label="@string/title_activity_onboarding"
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
layout="@layout/toolbar_default" />
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:orientation="vertical">
<!-- Here are a bunch of elements, the bottommost of which I would like visible when the keyboard is shown -->
</LinearLayout>
</ScrollView>
</LinearLayout>
答案 0 :(得分:1)