Android ScrollView不会自动滚动
我可能错过了一些非常简单的东西,但我一辈子都看不到 我正在尝试让ScrollView在Android应用程序中工作。虽然布局看起来不错,但文本/图像不会自动滚动Android ScrollView不会自动滚动,android,xml,scrollview,Android,Xml,Scrollview,我可能错过了一些非常简单的东西,但我一辈子都看不到 我正在尝试让ScrollView在Android应用程序中工作。虽然布局看起来不错,但文本/图像不会自动滚动 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<ScrollView
android:focusable="true"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:background="#f7f7f7"
android:layout_weight="1"
android:fillViewport="true"
android:orientation="vertical"
android:padding="25dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".NasaDailyImage" >
<TextView
android:id="@+id/imageTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/test_image_title" />
<TextView
android:id="@+id/imageDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/test_image_date" />
<ImageView
android:id="@+id/imageDisplay"
android:contentDescription="@string/test_image_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/test_image" />
<TextView
android:id="@+id/imageDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/test_image_description" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_weight="0">
<Button android:text="@string/refresh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:background="#ff8D8D8D"
android:onClick="refreshScreen"
android:gravity="center"/>
</LinearLayout>
</LinearLayout>
有人有什么想法吗?给scrollview一些高度,比如100dp。添加更多的文本视图。它将工作
<ScrollView
android:focusable="true"
android:layout_width="fill_parent"
**android:layout_height="fill_parent"**
android:background="#f7f7f7"
android:layout_weight="1"
android:fillViewport="true"
android:orientation="vertical"
android:padding="25dp" />
只需将父对象填充到滚动视图高度即可,谢谢-我也尝试过,但没有效果。ooooo不要像“/>”一样关闭此选项,只需使用“/>”的实例到“>”并在所有滚动视图结束后关闭此选项。谢谢您的回复,但是根据我上面的代码,标记已设置为“>”。只需删除此行“android:layout_weight=“1”从scroll view和runNo luck开始,我担心-仍然没有滚动。嘿,伙计,如果所有数据都在屏幕上,那么它将滚动,直到或除非它比显示屏大