2012-04-30 3 views
2

필자는 ScrollView 내부에 fills_parent 인 TableLayout을 가지고 있습니다. 소프트 키보드가 보이면 마지막 몇 개의 EditTexts가 가려집니다. 기술적으로 키보드를 표시하지 않으면 스크린이 모든 내용에 맞기 때문에 화면을 더 이상 아래로 스크롤 할 수 없습니다. 키보드가 보이면 키보드를 숨기지 않고 나머지 EditTexts 중 하나를 선택하여 값을 입력 할 수있게됩니다. this를 사용하여, 나는 시도했다 :안드로이드 소프트 키보드가 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을 추가하기로 결정했을 것입니다.

관련 문제