2011-04-26 53 views
0

我有由一個大的滾動視圖(包含的EditText字段)與被固定到屏幕(滾動視圖的未一部分)的底部上的按鈕沿一個活動。這是顯示我看到的問題的一個簡單示例。我的應用程序清單指定的android:所有活動windowSoftInputMode = adjustPan。滾動型與按鈕下卷軸不同內部TabHost

如果我直接運行這個活動,正確顯示一切和編輯字段之間滾動視圖滾動,因爲它應該。

我沒有足夠的積分,發表圖片或> 2層的超鏈接.....

No TabHost - edit first field

如果我運行此活動作爲TabHost的內容,滾動似乎受損害。每當EditText獲得焦點時,該活動就會正確平移到Edit字段。但是,它也會強制按鈕進入屏幕。

Inside TabHost - edit first field - Where did that button come from

我曾嘗試創建使用的LinearLayout這個活動的佈局(與按鈕切緣陰性),以及一個RelativeLayout的,都表現出相同的問題,通過滾動按鈕時,總是可見3個EditText字段。

有沒有人見過這樣的事情之前或有任何想法如何讓滾動到TabHost內正常工作?????

的LinearLayout版本

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" 
> 
<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_marginBottom="60dip" 
    > 
    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" 
     >  
     <EditText android:id="@+id/e1" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="30dip" 
      android:layout_marginBottom="30dip" 
      android:hint="edit text 1" 
      /> 
     <EditText android:id="@+id/e2" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="30dip" 
      android:layout_marginBottom="30dip" 
      android:hint="edit text 2" 
      /> 
     <EditText android:id="@+id/e3" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="30dip" 
      android:layout_marginBottom="30dip" 
      android:hint="edit text 3" 
      /> 
    </LinearLayout> 
</ScrollView> 
<Button 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Button" 
    android:layout_marginTop="-60dip" 
    android:layout_gravity="center" 
    /> 

RelativeLayout的版本

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
> 
<Button android:id="@+id/button1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Button" 
    android:layout_alignParentBottom="true" 
    android:layout_centerHorizontal="true" 
    /> 
<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_alignParentTop="true" 
    android:layout_above="@+id/button1" 
    > 
    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" 
     >  
     <EditText android:id="@+id/e1" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="30dip" 
      android:layout_marginBottom="30dip" 
      android:hint="edit text 1" 
      /> 
     <EditText android:id="@+id/e2" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="30dip" 
      android:layout_marginBottom="30dip" 
      android:hint="edit text 2" 
      /> 
     <EditText android:id="@+id/e3" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="30dip" 
      android:layout_marginBottom="30dip" 
      android:hint="edit text 3" 
      /> 
    </LinearLayout> 
</ScrollView> 

在此先感謝。

回答

0

在這種情況下,可以幫助其他人.....

所有被託管的TabHost內的活動使用的是Android:windowSoftInputMode = adjustPan。

然而,舉辦了TabHost活動是丟失的android:windowSoftInputMode = adjustPan。 有一次,我補充說,平移工作了TabHost內部或TabHost外SMAE。