Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/226.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 只在版面中滚动文本视图而不是在整个版面中滚动文本视图?_Android_Android Layout_Scrollview_Textview - Fatal编程技术网

Android 只在版面中滚动文本视图而不是在整个版面中滚动文本视图?

Android 只在版面中滚动文本视图而不是在整个版面中滚动文本视图?,android,android-layout,scrollview,textview,Android,Android Layout,Scrollview,Textview,我的xml布局中有几个布局在这些布局中我有一个包含大文本的textview。我需要你的帮助是如何设置只有文本视图垂直滚动没有整个布局。 这是我的xml布局 enter code here <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/inner_content" android:layout_width="fill_parent" andro

我的xml布局中有几个布局在这些布局中我有一个包含大文本的textview。我需要你的帮助是如何设置只有文本视图垂直滚动没有整个布局。 这是我的xml布局

enter code here

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/inner_content"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="@drawable/bg"
  android:orientation="vertical" >

<RelativeLayout
    android:id="@+id/relativeLayout1"
    android:layout_width="fill_parent"
    android:layout_height="45dip"
    android:background="@drawable/header"
    android:paddingLeft="2dip"
    android:paddingRight="2dip" >

    <Button
        android:id="@+id/sample_button"
        style="@android:style/Widget.Button.Small"
        android:layout_width="35dip"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_marginRight="10dip"
        android:background="@drawable/burger" />

    <ImageView
        android:id="@+id/imageView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:src="@drawable/home_button" />

    <TextView
        android:id="@+id/breakARTISTNAME"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#FFFFFF" />
</RelativeLayout>

<RelativeLayout
    android:layout_width="250dp"
    android:layout_height="374dp"
    android:layout_marginBottom="6dp"
    android:layout_marginLeft="35dp"
    android:layout_marginTop="20dp"
    android:background="#C71585" >

    <RelativeLayout
        android:id="@+id/linearLayout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_marginTop="25dp"
        android:background="@drawable/add_schedule_bg"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/imageButton1"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:paddingTop="3dp"
            android:src="@drawable/add_button" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@+id/imageButton1"
            android:paddingLeft="10dp"
            android:text="add to my schedual"
            android:textColor="#FFFFFF" />
    </RelativeLayout>

    <ImageView
        android:id="@+id/breakARTISTIMAGE"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/linearLayout1"
        android:layout_marginTop="14dp"
        android:src="@drawable/ic_launcher" />

    //here is the text i need only to be scrollalbe

    <TextView
        android:id="@+id/breakARTISTDESCRIPTION"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/breakARTISTIMAGE"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#FFFFFF" />

    <ImageView
        android:id="@+id/breakARTISTIMAGE2"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_above="@+id/breakARTISTDESCRIPTION"
        android:layout_alignParentRight="true"
        android:src="@drawable/ic_launcher" />
</RelativeLayout>
在此处输入代码
//这是我只需要滚动的文本
试试这个:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/inner_content"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/bg"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/relativeLayout1"
        android:layout_width="fill_parent"
        android:layout_height="45dip"
        android:background="@drawable/header"
        android:paddingLeft="2dip"
        android:paddingRight="2dip" >

        <Button
            android:id="@+id/sample_button"
            style="@android:style/Widget.Button.Small"
            android:layout_width="35dip"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="10dip"
            android:background="@drawable/burger" />

        <ImageView
            android:id="@+id/imageView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:src="@drawable/home_button" />

        <TextView
            android:id="@+id/breakARTISTNAME"
            android:layout_width="150dp"
            android:layout_height="150dp"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="#FFFFFF" />
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="250dp"
        android:layout_height="374dp"
        android:layout_marginBottom="6dp"
        android:layout_marginLeft="35dp"
        android:layout_marginTop="20dp"
        android:background="#C71585">

        <RelativeLayout
            android:id="@+id/linearLayout1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_marginTop="25dp"
            android:background="@drawable/add_schedule_bg"
            android:orientation="vertical">

            <ImageView
                android:id="@+id/imageButton1"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:paddingTop="3dp"
                android:src="@drawable/add_button" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:layout_toRightOf="@+id/imageButton1"
                android:paddingLeft="10dp"
                android:text="add to my schedual"
                android:textColor="#FFFFFF" />
        </RelativeLayout>

        <ImageView
            android:id="@+id/breakARTISTIMAGE"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/linearLayout1"
            android:layout_marginTop="14dp"
            android:src="@drawable/ic_launcher"/>


        <ScrollView
            android:id="@+id/breakSCROLLVIEW"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentBottom="true"
            android:layout_below="@+id/breakARTISTIMAGE">

            <TextView
                android:id="@+id/breakARTISTDESCRIPTION"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="#FFFFFF"/>

        </ScrollView>

        <ImageView
            android:id="@+id/breakARTISTIMAGE2"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_above="@+id/breakSCROLLVIEW"
            android:layout_alignParentRight="true"
            android:src="@drawable/ic_launcher"/>
    </RelativeLayout>

</LinearLayout>

试试这个:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/inner_content"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/bg"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/relativeLayout1"
        android:layout_width="fill_parent"
        android:layout_height="45dip"
        android:background="@drawable/header"
        android:paddingLeft="2dip"
        android:paddingRight="2dip" >

        <Button
            android:id="@+id/sample_button"
            style="@android:style/Widget.Button.Small"
            android:layout_width="35dip"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="10dip"
            android:background="@drawable/burger" />

        <ImageView
            android:id="@+id/imageView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:src="@drawable/home_button" />

        <TextView
            android:id="@+id/breakARTISTNAME"
            android:layout_width="150dp"
            android:layout_height="150dp"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="#FFFFFF" />
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="250dp"
        android:layout_height="374dp"
        android:layout_marginBottom="6dp"
        android:layout_marginLeft="35dp"
        android:layout_marginTop="20dp"
        android:background="#C71585">

        <RelativeLayout
            android:id="@+id/linearLayout1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_marginTop="25dp"
            android:background="@drawable/add_schedule_bg"
            android:orientation="vertical">

            <ImageView
                android:id="@+id/imageButton1"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:paddingTop="3dp"
                android:src="@drawable/add_button" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:layout_toRightOf="@+id/imageButton1"
                android:paddingLeft="10dp"
                android:text="add to my schedual"
                android:textColor="#FFFFFF" />
        </RelativeLayout>

        <ImageView
            android:id="@+id/breakARTISTIMAGE"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/linearLayout1"
            android:layout_marginTop="14dp"
            android:src="@drawable/ic_launcher"/>


        <ScrollView
            android:id="@+id/breakSCROLLVIEW"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentBottom="true"
            android:layout_below="@+id/breakARTISTIMAGE">

            <TextView
                android:id="@+id/breakARTISTDESCRIPTION"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="#FFFFFF"/>

        </ScrollView>

        <ImageView
            android:id="@+id/breakARTISTIMAGE2"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_above="@+id/breakSCROLLVIEW"
            android:layout_alignParentRight="true"
            android:src="@drawable/ic_launcher"/>
    </RelativeLayout>

</LinearLayout>


它破坏了我的布局。现在,文本视图在相对较长的时间内到处都是scrolling@MostafaAddam例如我改变了我的答案。请试一试。谢谢你,阿洛特,你帮了我大拇指朝上。还有一件事现在卷轴工作了,但是我的文字太长了。当卷轴结束时,仍然有一些行没有显示我该怎么办do@MostafaAddam:我对布局做了进一步的更改,但我认为您必须减少图像以适应布局在屏幕上。它破坏了我的布局。现在文本视图在相对长的时间里到处都是scrolling@MostafaAddam例如我改变了我的答案。请试一试。谢谢你,阿洛特,你帮了我大拇指朝上。还有一件事现在卷轴工作了,但是我的文字太长了。当卷轴结束时,仍然有一些行没有显示我该怎么办do@MostafaAddam:我对布局做了进一步的更改,但我认为您必须减少图像以适应布局在屏幕上。