Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android studio 滚动视图和文本_Android Studio - Fatal编程技术网

Android studio 滚动视图和文本

Android studio 滚动视图和文本,android-studio,Android Studio,如何使屏幕滚动 如何使用ScrollView?在我的活动中,有一个图片和文本,我需要向下或向上移动屏幕滚动。滚动视图XML资源非常易于使用,功能强大。只要用ScrollView标记在XML中包装您想要滚动的任何内容,其余内容都会为您处理。简单的例子: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_

如何使屏幕滚动


如何使用ScrollView?在我的活动中,有一个图片和文本,我需要向下或向上移动屏幕滚动。

滚动视图XML资源非常易于使用,功能强大。只要用
ScrollView
标记在XML中包装您想要滚动的任何内容,其余内容都会为您处理。简单的例子:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical"
android:background="@color/colorPrimary"
android:fillViewport="true">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/yourID"
        android:layout_weight="1" />

        ...
</LinearLayout></ScrollView>

...
本例显示了一个
LinearLayout
,其中填充了您需要的内容(本例中为TextView),必要时将在屏幕上滚动