将滚动视图添加到android布局

我有一个相对布局我要添加一个scrollView,问题是当我添加滚动视图时,我所有相对设置的小部件都丢失了他们的位置,我已经尝试了每一种可能性但我无法设置滚动正确看待,有人可以帮助我吗?我想将滚动视图放到xml文件的所有元素中.

代码

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff" >

    <ImageButton
        android:id="@+id/linearLayout1"
        android:layout_width="fill_parent"
        android:layout_height="140dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_weight="0.9"
        android:background="@drawable/subscribe_second_top"
        android:orientation="vertical" >
    </ImageButton>





            <EditText
                android:id="@+id/editText1"
                android:layout_width="270dp"
                android:layout_height="wrap_content"
                android:layout_below="@+id/bebasNeueTextView1"
                android:layout_centerHorizontal="true"
                android:ems="10"
                android:inputType="textEmailAddress" />

            <TextView
                android:id="@+id/bebasNeueTextView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/editText1"
                android:layout_centerHorizontal="true"
                android:text="THE EMAIL YOU WILL USE TO GET ALL YOUR APPS CREATED BY THE SOFT"
                android:textColor="#000000"
                android:textSize="7sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/bebasNeueTextView6"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/editText2"
                android:layout_centerHorizontal="true"
                android:text="YOUR GOOGLE PLAY STORE ORDER NUMBER,IN ORDER TO PROVE YOU BOUG"
                android:textColor="#000000"
                android:textSize="7sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/bebasNeueTextView4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/bebasNeueTextView2"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="16dp"
                android:text="ENTER YOUR PLAY STORE ORDER NUMBER"
                android:textColor="#94c23e"
                android:textSize="13sp"
                android:textStyle="bold" />

            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="80dp"
                android:layout_alignParentBottom="true"
                android:background="@drawable/subscribe_second_bottom"
                android:paddingBottom="5dp"
                android:paddingTop="30dp" >

                <com.apkcreator.fwd.BebasNeueButton
                    android:id="@+id/finishButton"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:layout_centerHorizontal="true"
                    android:background="#94c23e"
                    android:paddingBottom="10dp"
                    android:paddingLeft="30dp"
                    android:paddingRight="30dp"
                    android:paddingTop="10dp"
                    android:text="FINISH"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </RelativeLayout>

            <TextView
                android:id="@+id/bebasNeueTextView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="170dp"
                android:text="ENTER YOUR EMAIL"
                android:textColor="#94c23e"
                android:textSize="13sp"
                android:textStyle="bold" />

            <EditText
                android:id="@+id/editText2"
                android:layout_width="270dp"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/editText1"
                android:layout_below="@+id/bebasNeueTextView4"
                android:ems="10" 
                android:layout_centerHorizontal="true">


            </EditText>

</RelativeLayout>
 </ScrollView>

解决方法

检查此链接
How to add scroll bar to the Relative Layout?

您的问题可能与视口有关,ScrollLayout上的android:fillViewport =“true”应该可以解决您的问题.

查看xml,您可以使用垂直LinearLayout设置此文件,对于此用例更加简单.

顺便说一句,我的建议是避免用户输入上的滚动条,如注册,登录…你的表单只包含2个字段,我相信你可以安排它一次全部显示在屏幕上(更好的用户体验!).

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...