Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.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_Xml_Android Studio - Fatal编程技术网

如何在Android Studio中同时水平滚动多个文本视图?

如何在Android Studio中同时水平滚动多个文本视图?,android,xml,android-studio,Android,Xml,Android Studio,我在左边有图像,在右边有4个文本视图。如果文本太长,我希望4个文本视图(没有图像的整体)作为一个整体水平滚动。我已经尝试过这个代码textName.setMovementMethod(新的ScrollingMovementMethod());textName.setHorizontallyScrolling(true)但它只允许1个文本视图滚动。我尝试在我的XML中添加ScrollView,但它不起作用,HorizontalScrollView使我的应用程序崩溃。以下是我的XML: <Re

我在左边有图像,在右边有4个文本视图。如果文本太长,我希望4个文本视图(没有图像的整体)作为一个整体水平滚动。我已经尝试过这个代码
textName.setMovementMethod(新的ScrollingMovementMethod());textName.setHorizontallyScrolling(true)但它只允许1个文本视图滚动。我尝试在我的XML中添加
ScrollView
,但它不起作用,
HorizontalScrollView
使我的应用程序崩溃。以下是我的XML:

<RelativeLayout 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">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="77dp"
        android:layout_height="125dp"
        android:layout_alignParentStart="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginStart="26dp"
        android:layout_marginLeft="26dp"
        android:layout_marginTop="20dp"
         />

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scrollbars="horizontal">-->
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">


                <TextView
                    android:id="@+id/textView2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="125dp"
                    android:layout_marginStart="125dp"
                    android:layout_marginTop="20dp"
                    android:text="TextViewName2"
                    android:textSize="20sp" />
                    

                    <TextView
                        android:id="@+id/textView4"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="125dp"
                        android:layout_marginStart="125dp"
                        android:layout_marginTop="5dp"
                        android:text="TextViewName4"
                        android:textSize="17sp"
                        />
                        

                        <TextView
                        android:id="@+id/textView3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                            android:layout_marginLeft="125dp"
                            android:layout_marginStart="125dp"
                            android:layout_marginTop="5dp"
                            android:text="TextViewName3"
                            android:textSize="17sp"
                            />
           

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="125dp"
            android:layout_marginStart="125dp"
            android:layout_marginTop="5dp"
            android:text="TextViewName1"
            android:textSize="17sp"
            />
           



        </LinearLayout>

    </ScrollView>


</RelativeLayout>

-->