2012-07-23 44 views
1

我有一個頁面,其中包含各種編輯文本和微調。爲了啓用滾動,我已將android:windowSoftInputMode="adjustResize"放入了我的清單中。但是當我滾動我的視圖時,我的焦點編輯文本正在失去焦點。我的意思是,假設我有第一個編輯文本,我向下滾動,然後回到我的第一個編輯文本,但現在我的第一個編輯文本已經失去了重點。有趣的是,當我在API level4.0測試相同的東西時,它的工作正常,而不是在4.0之前滾動時編輯文本失去焦點

請幫我做些什麼或者建議一些我失去的東西。

而對於代碼,它只是幾個編輯文本這些工作呢

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

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

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

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/hello" /> 

      <EditText 
       android:id="@+id/et_user" 
       android:layout_width="250dp" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:singleLine="true" /> 
     </LinearLayout> 

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

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/hello" /> 

      <EditText 
       android:id="@+id/et_user" 
       android:layout_width="250dp" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:singleLine="true" /> 
     </LinearLayout> 

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

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/hello" /> 

      <EditText 
       android:id="@+id/et_user" 
       android:layout_width="250dp" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:singleLine="true" /> 
     </LinearLayout> 

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

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/hello" /> 

      <EditText 
       android:id="@+id/et_user" 
       android:layout_width="250dp" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:singleLine="true" /> 
     </LinearLayout> 



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

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/hello" /> 

      <EditText 
       android:id="@+id/et_user" 
       android:layout_width="250dp" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:singleLine="true" /> 
     </LinearLayout> 

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

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/hello" /> 

      <EditText 
       android:id="@+id/et_user" 
       android:layout_width="250dp" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:singleLine="true" /> 
     </LinearLayout> 

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

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/hello" /> 

      <EditText 
       android:id="@+id/et_user" 
       android:layout_width="250dp" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:singleLine="true" /> 
     </LinearLayout> 

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

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/hello" /> 

      <EditText 
       android:id="@+id/et_user" 
       android:layout_width="250dp" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:singleLine="true" /> 
     </LinearLayout> 

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

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/hello" /> 

      <EditText 
       android:id="@+id/et_user" 
       android:layout_width="250dp" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:singleLine="true" /> 
     </LinearLayout> 

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

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/hello" /> 

      <EditText 
       android:id="@+id/et_user" 
       android:layout_width="250dp" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:singleLine="true" /> 
     </LinearLayout> 

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

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/hello" /> 

      <EditText 
       android:id="@+id/et_user" 
       android:layout_width="250dp" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:singleLine="true" /> 
     </LinearLayout> 

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

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/hello" /> 

      <EditText 
       android:id="@+id/et_user" 
       android:layout_width="250dp" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:singleLine="true" /> 
     </LinearLayout> 

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

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/hello" /> 

      <EditText 
       android:id="@+id/et_user" 
       android:layout_width="250dp" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:singleLine="true" /> 
     </LinearLayout> 
    </LinearLayout> 

</ScrollView> 

回答

0

這就是Android是提供,並可能有一些變通,但目前這是它如何工作的。所以我可以告訴你的是要受到這個限制。任何更新都會通知你。