0

I want to know why ScrollView is not working in this Source.

The tap in this source has Calendar and EditText.

If I click EditText and softKey pops up, I want to scroll.

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true"
    android:id="@+id/scroll"   >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context=".AddActivity" >
        <TabHost
            android:id="@android:id/tabhost"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

            <LinearLayout
               android:layout_width="fill_parent"
               android:layout_height="fill_parent"
               android:orientation="vertical">

                <TabWidget
                    android:id="@android:id/tabs"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"/>

                <FrameLayout
                    android:id="@android:id/tabcontent"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" >
                </FrameLayout>       

            </LinearLayout>
        </TabHost>
    </LinearLayout>
</ScrollView>

--- In tab ---

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button 
    android:id="@+id/first_button"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true" 
    android:text="save"/>
<LinearLayout 
    android:id="@+id/first_LL"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:layout_alignParentTop="true"
    android:layout_above="@id/first_button">
    <TextView
        android:id="@+id/firstday"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity = "center"/>
    <add.AddCalendar
        android:id="@+id/Cfirst"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:paddingTop="1dp"
        android:paddingBottom="1dp"
        />      
    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"  >
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "Date : "/>
        <Spinner
            android:id="@+id/first_Year"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "year"/>
        <Spinner
            android:id="@+id/first_Month"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "month"/>
        <Spinner
            android:id="@+id/first_Day"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "day"/>
    </LinearLayout>

    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "sth : "
            android:gravity="top"/>
        <EditText
            android:id="@+id/first_Text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint=" write "
            android:gravity="top"/>
    </LinearLayout>
</LinearLayout>

I don't know why this code doesn't work well.

4

1 に答える 1

0

I think you should wrap your layout in tab with ScrollView instead of the entire screen

于 2013-02-23T11:27:21.003 に答える