2013-02-23 78 views
0

我想知道为什么ScrollView不能在这个Source中工作。ScrollView在android中不起作用

此来源中的水龙头有日历和EditText。

如果我点击EditText并弹出softKey,我想滚动。

<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> 

---在标签---

<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> 

我不知道为什么这个代码不工作。

回答

0

我想你应该与滚动型包装在标签中的布局,而不是整个屏幕

+0

我解决这个问题,我的包裹在标签布局滚动型代替部份整个屏幕,并改变RelativeLayout的到的LinearLayout。非常感谢你。 – 2013-02-24 23:27:27