2017-04-10 94 views
1

我想創建佈局,包括從圖像和幾EditTexts正常情況下所顯示的下一個圖像中
Before editingAndroid的調整佈局的一部分時,軟鍵盤顯示

但是,當用戶開始輸入文字我這裏顯示的
After the keyboard
我該怎麼辦呢
軟鍵盤在屏幕的底部,
EditTexts這件事,但是圖像的尺寸根據軟鍵盤的大小:需要改變佈局的下一個呢? 在此先感謝

+0

把它們放在一個滾動型,並確保在您添加清單「adjustResize」用於相應的活動。 –

+0

但我不需要滾動,我需要適合整個屏幕的佈局 –

回答

1

試試這個代碼

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1"/> 

    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"/> 

    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"/> 

</LinearLayout> 

還設置

android:windowSoftInputMode="adjustResize" 

物業你的活動在AndroidManifest.xml