Android 无法使滚动视图工作

Android 无法使滚动视图工作,android,xml,scrollview,Android,Xml,Scrollview,我有一个充满编辑文本的布局,它的目的是保存用户的输入,但我有很多,我想放更多,但我只是没有足够的空间在一个5英寸的手机,使他们都出现,我需要滚动以查看其他输入。目前我有这个XML,但无法使ScrollView工作!我需要让它对整个视图起作用。你们能帮帮我,告诉我我做错了什么吗?谢谢 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.an

我有一个充满编辑文本的布局,它的目的是保存用户的输入,但我有很多,我想放更多,但我只是没有足够的空间在一个5英寸的手机,使他们都出现,我需要滚动以查看其他输入。目前我有这个XML,但无法使
ScrollView
工作!我需要让它对整个视图起作用。你们能帮帮我,告诉我我做错了什么吗?谢谢

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/ScrollView01"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true" >

    <RelativeLayout 

        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:background="@color/teste"
        android:gravity="bottom"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="com.luisalmeida.theblackbook.AddHookupActivity$PlaceholderFragment" 

    >

    <EditText
        android:id="@+id/editTextFrom"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/textViewLocation"
        android:layout_alignLeft="@+id/editTextPlace"
        android:ems="10" />

    <EditText
        android:id="@+id/editTextName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/textViewName"
        android:layout_alignRight="@+id/editTextPlace"
        android:layout_toRightOf="@+id/textViewPlace"
        android:ems="10" />

    <TextView
        android:id="@+id/textViewLocation"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/textViewObs"
        android:layout_alignLeft="@+id/textViewPlace"
        android:layout_marginBottom="21dp"
        android:text="@string/homeHookup"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@color/teste2" />

    <TextView
        android:id="@+id/textViewObs"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/editTextObs"
        android:layout_alignLeft="@+id/textViewLocation"
        android:layout_marginBottom="13dp"
        android:text="@string/obsHookup"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@color/teste2" />

    <TextView
        android:id="@+id/textViewPlace"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/editTextFrom"
        android:layout_alignLeft="@+id/textViewAge"
        android:layout_marginBottom="14dp"
        android:text="@string/placeHookup"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@color/teste2" />

    <EditText
        android:id="@+id/editTextPlace"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/textViewPlace"
        android:layout_toRightOf="@+id/textViewPlace"
        android:ems="10" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/editTextPlace"
        android:layout_alignLeft="@+id/textViewName"
        android:layout_marginBottom="7dp"
        android:text="@string/ageHookup"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@color/teste2" />

    <EditText
        android:id="@+id/editTextAge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/textViewAge"
        android:layout_toRightOf="@+id/textViewPlace"
        android:ems="10" />

    <TextView
        android:id="@+id/textViewName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/editTextAge"
        android:layout_alignParentLeft="true"
        android:layout_marginBottom="11dp"
        android:layout_marginLeft="31dp"
        android:text="@string/nameHookup"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@color/teste2" />

    <EditText
        android:id="@+id/editTextObs"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textViewObs"
        android:layout_alignParentBottom="true"
        android:layout_alignRight="@+id/editTextFrom"
        android:layout_marginBottom="82dp"
        android:ems="10" >

    </EditText>


    <Button
        android:id="@+id/buttonSave"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignRight="@+id/textViewPlace"
        android:layout_marginBottom="14dp"
        android:text="@string/saveHookup"
        android:onClick="saveHookup" />

    </RelativeLayout>
</ScrollView>

也许你可以试试这个:

<ScrollView>
    <TableLayout>
        <TableRow>
            <TextView/>
            <EditText/>
        </TableRow>
        <TableRow>
            <TextView/>
            <EditText/>
        </TableRow>
        <TableRow>
            <TextView/>
            <EditText/>
        </TableRow>
        <TableRow>
            <TextView/>
            <EditText/> 
        </TableRow>
        // Add other EditText and TextView here
   </TableLayout>
</ScrollView>

//在此处添加其他EditText和TextView
更新1:


@LuisAlmeida:它不会阻止您将多个组件添加到
表格行
,这样您就可以得到您的名字:“input here”(输入此处)布局(请参见上面我更新的布局)。此外,您在上面发布的布局不会给您命名:“input here”布局,除非我遗漏了一些内容。

到目前为止您尝试了什么?“不能让它工作”并没有告诉我们这个问题。Stacktrace?当我运行应用程序时,滚动视图根本不起作用,我翻转单元格,文本视图和编辑视图互相覆盖,当我尝试滚动时,它没有给出任何响应,好像它甚至没有改变垂直
线性布局的相对位置,但如果我这样做,我的对齐都消失了,我必须重做整个布局layout@velis我刚改成线性布局,它的工作原理和我想要的一样!谢谢我不想添加一个表格,因为它的目的是添加一个人的个人资料,名字等等,比如这个名字:“这里输入”要先尝试线性布局的方法,如果它不起作用,我会尝试一下!是的,我把它放在像这样的文本视图编辑视图;文本视图编辑视图;文本视图编辑视图;线性布局就像我想要的一样!不过还是要谢谢你!