scrollview不是从活动的顶部开始

时间:2014-06-28 16:22:50

标签: android eclipse scrollview

当我打开一个名为“预订”的新活动时,活动会直接关注滚动视图的中心。我尝试将focusable(true)设置为仅顶部,但是当我这样做时,不再允许在触摸时使用edittext框。

xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:focusable="false"
android:focusableInTouchMode="false"
android:orientation="vertical"
tools:context="com.first.android.spaseafoods.Contact"
tools:ignore="MergeRootFrame" >

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:scrollbars="vertical" >

   <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:background="#000000"
       android:focusable="false"
       android:focusableInTouchMode="false"
       android:orientation="vertical" >

        <android.support.v7.widget.Space
            android:id="@+id/space1"
            android:layout_width="20sp"
            android:layout_height="30sp" />

        <TextView
            android:id="@+id/textViewTitle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:text="Please fill out the following information if you would like to make a reservation, you will receive confirmation within 24 hours."
            android:textColor="#ffffff"
            android:textSize="20sp" />

        <android.support.v7.widget.Space
            android:id="@+id/space2"
            android:layout_width="20sp"
            android:layout_height="30sp" />

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:text="Name *"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#ffffff" />

        <EditText
            android:id="@+id/editTextName"
            android:layout_width="330dp"
            android:layout_height="30dp"
            android:background="@drawable/rounded_edittext"
            android:ems="10" />

        <android.support.v7.widget.Space
            android:id="@+id/space3"
            android:layout_width="20sp"
            android:layout_height="30sp" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:text="Phone *"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#ffffff" />

        <EditText
            android:id="@+id/editTextPhone"
            android:layout_width="330dp"
            android:layout_height="30dp"
            android:background="@drawable/rounded_edittext"
            android:ems="10" />

        <android.support.v7.widget.Space
            android:id="@+id/space4"
            android:layout_width="20sp"
            android:layout_height="30sp" />

        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:text="E-mail"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#ffffff" />

        <EditText
            android:id="@+id/editTextEmail"
            android:layout_width="330dp"
            android:layout_height="30dp"
            android:background="@drawable/rounded_edittext"
            android:ems="10"
            android:inputType="textEmailAddress" />

        <android.support.v7.widget.Space
            android:id="@+id/space5"
            android:layout_width="20sp"
            android:layout_height="30sp" />

        <TextView
            android:id="@+id/textView4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Number of people"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#ffffff" />

        <EditText
            android:id="@+id/editTextPeople"
            android:layout_width="75sp"
            android:layout_height="30sp"
            android:background="@drawable/rounded_edittext"
            android:ems="10"
            android:inputType="number" >

        <requestFocus />
        </EditText>

        <android.support.v7.widget.Space
            android:id="@+id/space6"
            android:layout_width="20sp"
            android:layout_height="30sp" />

        <TextView
            android:id="@+id/textView5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Reservation Date *"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#ffffff" />

        <EditText
            android:id="@+id/editTextDate"
            android:layout_width="150sp"
            android:layout_height="30sp"
            android:background="@drawable/rounded_edittext"
            android:ems="10"
            android:inputType="date" >

            <requestFocus />
        </EditText>

        <android.support.v7.widget.Space
            android:id="@+id/space7"
            android:layout_width="40sp"
            android:layout_height="30sp" />

        <TextView
            android:id="@+id/textView6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Reservation Time *"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#ffffff" />

        <EditText
            android:id="@+id/editTextTime"
            android:layout_width="150sp"
            android:layout_height="30sp"
            android:background="@drawable/rounded_edittext"
            android:ems="10"
            android:inputType="time" >

            <requestFocus />
        </EditText>

        <android.support.v7.widget.Space
            android:id="@+id/space8"
            android:layout_width="20sp"
            android:layout_height="30sp" />

        <TextView
            android:id="@+id/textView7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Comments"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#ffffff" />

        <EditText
            android:id="@+id/editTextComments"
            android:layout_width="330dp"
            android:layout_height="100dp"
            android:background="@drawable/rounded_edittext"
            android:ems="10"
            android:inputType="textMultiLine"
            android:lines="4" />

        <android.support.v7.widget.Space
            android:id="@+id/space9"
            android:layout_width="20sp"
            android:layout_height="30sp" />

        <Button
            android:id="@+id/button1"
            android:layout_width="330dp"
            android:layout_height="60dp"
            android:onClick="sendFeedback"
            android:text="Submit"
            android:textColor="#ffffff"
            android:textSize="25sp" />

        </LinearLayout>


</ScrollView>

0 个答案:

没有答案