2

佈局我下一個XML佈局如何設置上述軟鍵盤

<ScrollView 
    android:id="@+id/transfer_scroller" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/blue_500" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 
     <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="400dp" 
     android:orientation="vertical" ></LinearLayout> 
     <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="400dp" 
     android:orientation="vertical" ></LinearLayout> 
     <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 
     <EditText 
         android:id="@+id/tv_money_type" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_gravity="center_horizontal|center_vertical" 
         android:textColor="@color/gray_400"> 
        </EditText> 
        <Button 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_gravity="center_horizontal" 
         android:background="@android:color/transparent" 
         android:text="@string/btn_transfer_select_receiver" 
         android:textColor="@color/blue_500" /> 

     </LinearLayout>   
</LinearLayout> 

當我向下滾動,點擊EDITTEXT - 開放softKeyBoard和佈局調整大小,所以我只能看到EDITTEXT領域,我需要所有最後LinearLayout位於鍵盤之上,因此用戶可以在editText下面看到btn。

這裏是我的清單中的活動:

<activity 
      android:name=".acitivity.Activity" 
      android:label="@string/title_activity" 
      android:theme="@style/AppTheme.NoActionBar" 
      android:screenOrientation="portrait" 
      android:windowSoftInputMode="adjustPan|stateVisible"> 
     </activity> 

我試圖設置android:windowSoftInputMode="adjustResize"但它看起來像它不與滾動視圖工作...

任何想法如何解決這一問題?

+0

你的意思是主要LinearLayout裏面scrollView?或ScroollView? –

+0

你應該在滾動視圖中設置它 – warlock

回答

1

1)在AndroidManifest.xml中使用:

  android:windowSoftInputMode="adjustResize" 

2)Check this one...

3),或者你可以試試這個:

  android:windowSoftInputMode="adjustResize|stateVisible" 

如果需要打開原來鍵盤。

希望它可以幫助你。