scrollview在我的布局中不起作用

时间:2013-06-06 15:59:29

标签: android layout

我使用这种布局:

<?xml version="1.0" encoding="UTF-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scroller"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true" 
    android:background="#00868B">


<RelativeLayout 
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 >

  <TextView android:layout_height="wrap_content"
        android:layout_width="fill_parent" 

        android:gravity="center"
        android:layout_alignParentTop="true" 
        />
  <EditText

    android:layout_width="match_parent"
    android:layout_height="wrap_content"


  />

   <TextView android:layout_height="wrap_content"
        android:layout_width="fill_parent" 
        android:gravity="center"
        android:layout_below="@+id/title" />

    <EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"

  />


 <Button ..
    android:layout_width="match_parent"
    android:layout_height="50dp" 
    android:text="@string/getloc" 

    />

 <Button ..
    android:layout_width="match_parent"
    android:layout_height="50dp" 


     />

 <Button ..
    android:layout_width="match_parent"
  ..
    android:layout_alignParentBottom="true" 

    />

</RelativeLayout>



</ScrollView>

没有滚动视图。 我希望当用户在第二个textview中输入“down”时,因为textview会变大但第一个按钮是稳定的并阻​​挡视图。

2 个答案:

答案 0 :(得分:0)

如果您想在键盘出现时避免按钮上升,可以将android:windowSoftInputMode="adjustNothing"放在Android Manifest的活动节点上。然后,他们在打字时不会打扰你。

答案 1 :(得分:0)

好的,我找到了。

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scroller2"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true" 
    android:background="#00868B">

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

<RelativeLayout 

 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 >

<TextView android:layout_height="wrap_content"


  <EditText

  />

   <TextView android:layout_height="wrap_content"


    <EditText

  />
    </RelativeLayout>
<Button 

    />

 <Button 

     />

 <Button

    />

</LinearLayout>
</ScrollView>