Android 如何使scrollview增长并向上滚动?
我的问题是,我向LinearLayout添加了新消息,而ScrollView每次都具有“离开”的属性。或者,例如,一个打开的键盘会导致滚动条下沉到它下面。我试着使用layout_gravity bottom,这给了我想要的结果,但滚动不起作用。从本质上说,我的问题是如何从布局到底部允许向上滚动。以下是我的xml:Android 如何使scrollview增长并向上滚动?,android,xml,scrollview,android-linearlayout,gravity,Android,Xml,Scrollview,Android Linearlayout,Gravity,我的问题是,我向LinearLayout添加了新消息,而ScrollView每次都具有“离开”的属性。或者,例如,一个打开的键盘会导致滚动条下沉到它下面。我试着使用layout_gravity bottom,这给了我想要的结果,但滚动不起作用。从本质上说,我的问题是如何从布局到底部允许向上滚动。以下是我的xml: <ScrollView android:id="@+id/messscroll" android:layout_width="match_parent" android:layo
<ScrollView
android:id="@+id/messscroll"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/relativeLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout2">
<LinearLayout
android:id="@+id/messagebox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="false"
android:baselineAligned="false"
android:clickable="true"
android:divider="@drawable/separator"
android:dividerPadding="3dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:orientation="vertical"
android:paddingBottom="1px"
android:showDividers="middle"/>
对于干扰滚动视图的键盘相关问题,您可以在活动的清单条目中使用android:WindowsOfInputMode=“StateAllwayShidden | adjustPan”,例如:
<activity
android:name=".activities.LoginActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" />
我指的是它的工作原理,但当我在你的帖子中键入更多的描述以及可能的屏幕截图时,我有一个空白的位置可能会帮助别人!