2012-04-30 96 views
2

我有一個TableLayout,它在ScrollView裏面有fills_parent。除了顯示軟鍵盤時,一切都可以完美運行,它會遮擋最後幾個EditText。從技術上講,由於沒有顯示鍵盤,屏幕不能再滾動下來,屏幕適合所有的內容。只是在顯示鍵盤時,我無法向下滾動以查看剩餘的EditText,而不隱藏鍵盤,並允許用戶選擇並將值輸入到其中一個較低的EditText中。使用this,我已經試過:Android軟鍵盤在ScrollView中遮擋EditTexts

Window.SetSoftInputMode((int)SoftInput.AdjustPan); 

Window.SetSoftInputMode((int)SoftInput.AdjustResize); 

[Activity(WindowSoftInputMode = SoftInput.AdjustPan)] 

[Activity(WindowSoftInputMode = SoftInput.AdjustResize)] 

Window.SetFlags(WindowManagerFlags.AltFocusableIm, WindowManagerFlags.AltFocusableIm); 

那只是防止鍵盤出現。這不是我所需要的。我需要調整內容以便在可見時顯示在鍵盤上方,以便我可以繼續滾動至顯示的鍵盤底部的EditText。摘自很長的xml。該表在代碼中動態填充。

<ScrollView 
android:id="@+id/peScroll" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_below="@id/security"> 
    <TableLayout 
    android:id="@+id/poweredEquip" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_centerVertical="true" 
    android:stretchColumns="*" 
    android:gravity="center" 
    android:padding="10dip">   
    <TableRow 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/tab_bg_unselected" 
     android:gravity="center"> 
     <TextView 
     android:text="Serial" 
     android:textSize="15sp" 
     android:textColor="@android:color/black" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:ellipsize="middle" 
     android:gravity="center" 
     android:layout_column="1"/> 
    </TableRow> 
    </TableLayout> 
</ScrollView> 

回答

1

可能不是最完美的解決方案,但決定只是一個大marginBottom添加到最後一行。