2012-04-03 46 views
7

我不是在尋找代碼,要麼我不會發表任何,只是一個解釋,因爲我有點失落。android adjustresize adjustpan着名的問題

軟鍵盤出現時,存在調整大小的主要問題。

在我的情況

我有2 EDITTEXT feeded一個ListView和TextView的許多使用自定義CursorAdapter的數據庫內容。

1)AdjustPan

這很簡單。當我使用adjustPan屬性時,一切工作都很好,除了當我在列表視圖中按下editText並且列表視圖大於屏幕大小時,我無法滾動。這實際上是正常的行爲,我可以理解它。

2)AdjustResize

在這裏,我可以滾動,就像我的願望。

此屬性是我想要使用的。但我面對2個問題:

  • 當我按下兩個EDITTEXT之一,我不能寫在不可能的,甚至認爲它具有焦點。我強迫softkeyboard出現,我嘗試鍵入一些字母(請記住這個editText是關注的),但沒有任何反應。

  • 再次,當我按兩個editText中的一個時,它只是重組(顯然是隨機)listview的項目。即使認爲它可以與adjustPan完美協同工作,但使用adjustResize時,它會混淆listView的項目。

有關這兩個問題之一的任何信息將有所幫助。你甚至可以要求代碼,但再一次,我只是尋找一個可能有幫助的一般性解釋。謝謝。

回答

0

這裏提到的問題在我的應用程序中面臨着同樣的問題,這裏我的代碼中的一些更改是在我的應用程序中正常工作。請試試這個...

<activity android:name="com.MainActivity" 
       android:configChanges="orientation|screenSize"/> 

<ListView 
     android:id="@+id/fields_list_view" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:descendantFocusability="afterDescendants" 
     android:focusableInTouchMode="true" 
     android:focusable="true" 
     /> 


<EditText 
       android:id="@+id/input_edit_text" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:cursorVisible="true" 
       android:gravity="top" 
       android:inputType="none" 
       android:textColor="@color/black"/> 
相關問題