2011-10-27 9 views
1

これは、ソフトキーボードが隠されているときの私のアプリです。 enter image description here キーボードが表示されているときに、上のエディットボックスが消えます。 enter image description here このようになります。キーボードが表示されているときのレイアウトの問題

私の質問は、キーボードが表示されているときに両方の編集ボックスを表示するにはどうすればいいですか?私は、編集ボックスの間の唯一のスペースを小さくすることにしたい...しかし、両方のボックスが表示されるように

私のレイアウトはこれまでAndroidマニフェストにこの

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_height="fill_parent" android:layout_width="fill_parent" 
    android:id="@+id/relativeLayout1"> 
    <EditText android:id="@+id/editText1" android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" android:layout_width="fill_parent"> 
     <requestFocus></requestFocus> 
    </EditText> 
    <EditText android:id="@+id/editText2" android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" android:layout_width="fill_parent"></EditText> 
    <ImageView android:id="@+id/imageView1" 
     android:layout_height="wrap_content" android:layout_below="@id/editText1" 
     android:layout_above="@id/editText2" android:background="@drawable/icon" 
     android:layout_width="fill_parent"></ImageView> 
</RelativeLayout> 

答えて

5

行くようなもので、「ウィンドウを変更全体のビューを調整するadjustPanからadjustResizeに「ソフト入力モード」を選択すると、ビューのサイズが変更されます。

+1

私の目にはアンドロイドを入れました:windowSoftInputMode = "stateVisible | adjustResize"それはうまくいきますが、これはどういう意味なのでしょうか?これはコードで変更できますか? – Lukap

+0

Androidは、入力したフィールドがキーボードによって隠されていないことを確認するために、ビューを処理しようとします。これを行うにはいくつかの方法があります。パンニングはフィールドを見ることができるまでビュー全体を上に移動するだけです。サイズを変更すると、ビュー全体がサイズ変更され、キーボードで隠されていないスペースが必要になります。コードで設定する方法はわかりませんが、おそらくどこかに1つあります。それはXMLでもそれを設定する標準です。 –

関連する問題