在我对安卓应用程序原型的模拟中,滚动视图(线性布局)不是滚动的



在我的安卓应用程序中,我在滚动视图中有一个线性布局,但是当我在模拟器中打开应用程序时,我无法滚动滚动视图。

我不知道这是否是解决方案,但我不使用鼠标,而只使用触摸板,当我尝试 2 指滚动时,模拟器的行为就像我按下按钮一样。我试图在其中放置填充视口函数,但它仍然不起作用。

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
tools:context=".HomeScreen">
<Button
android:id="@+id/settingsNavigator"
android:layout_width="0dp"
android:layout_height="110dp"
android:layout_marginTop="40dp"
android:text="SETTINGS"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
<TextView
android:id="@+id/textView"
android:layout_width="0dp"
android:layout_height="45dp"
android:text="Not connected"
android:textAlignment="center"
android:textColor="#FF0000"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button5" />
<Button
android:id="@+id/button5"
android:layout_width="0dp"
android:layout_height="120dp"
android:layout_marginTop="25dp"
android:text="Button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ScrollView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="55dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/settingsNavigator">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/button15"
android:layout_width="match_parent"
android:layout_height="90dp"
android:text="Button" />
<Button
android:id="@+id/button14"
android:layout_width="match_parent"
android:layout_height="90dp"
android:text="Button" />
<Button
android:id="@+id/button13"
android:layout_width="match_parent"
android:layout_height="90dp"
android:text="Button" />
<Button
android:id="@+id/button12"
android:layout_width="match_parent"
android:layout_height="90dp"
android:text="Button" />
<Button
android:id="@+id/button11"
android:layout_width="match_parent"
android:layout_height="90dp"
android:text="Button" />
<Button
android:id="@+id/button10"
android:layout_width="match_parent"
android:layout_height="90dp"
android:text="Button" />
</LinearLayout>
</ScrollView>
</android.support.constraint.ConstraintLayout>

应用程序构建工作正常,但滚动是唯一不起作用的东西。

好吧,我自己很快就想通了。似乎我早就问了很多,没有真正考虑过。尽管该解决方案可能会帮助其他人:

我只是把所有东西都放在另一个线性布局中。这解决了问题。现在只有底部在滚动,而上部保持不变,这正是我想要的。

最新更新