0

私はテキストボックスがあるAndroidアプリを開発しています..私が欲しいのは、そのテキストボックスのOnclickです.キーボードの下にあるレイアウトボタンは、キーボードによって隠されているため、キーボードボタンと一緒に表示されるはずです. 以下のコードをxmlで使用しています。

     <LinearLayout
            android:id="@+id/layout1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" 
            android:layout_weight=".20">

        <EditText
            android:id="@+id/edittext1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:cursorVisible="false"
            android:ems="10"
            android:gravity="top"
            android:hint="Message : "
            android:inputType="textMultiLine"
            android:scrollbars="vertical"
            android:textColor="#000000"
            android:textSize="15sp"
            android:visibility="visible" />
    </LinearLayout>

   <LinearLayout
    android:id="@+id/linearLayout2"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight=".80"
    android:background="@drawable/albgbckgrnd"
    android:orientation="horizontal" >

    <ImageButton
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="5dp"
        android:layout_weight=".33"
        android:textSize="25sp"
        android:typeface="sans"
        android:visibility="visible" />

    <ImageButton
        android:id="@+id/button2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="5dp"
        android:layout_weight=".33"
        android:textSize="25sp"
        android:typeface="sans"
        android:visibility="visible" />

    <ImageButton
        android:id="@+id/button3"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="5dp"
        android:layout_weight=".33"           
        android:textSize="25sp"
        android:typeface="sans"
        android:visibility="visible" />
</LinearLayout>

やり方がわからない!助けてください!ありがとう!

4

1 に答える 1

1

使用する

"adjustResize" 

Androidのドキュメントによると

アクティビティのメイン ウィンドウは、画面上にソフト キーボード用のスペースを確保するために常にサイズ変更されます。

これをマニフェスト ファイルのアクティビティに次のように追加します

  <activity android:name="YourActivityName" 
            android:windowSoftInputMode="adjustResize">

このようにレイアウトを更新します

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/parent"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="10dp" >

    <LinearLayout
        android:id="@+id/layout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight=".20"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/edittext1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:cursorVisible="false"
            android:ems="10"
            android:gravity="top"
            android:hint="Message : "
            android:inputType="textMultiLine"
            android:scrollbars="vertical"
            android:textColor="#000000"
            android:textSize="15sp"
            android:visibility="visible" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout2"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight=".80"
        android:background="#ff00"
        android:orientation="horizontal" >

        <ImageButton
            android:id="@+id/button1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="5dp"
            android:layout_weight=".33"
            android:textSize="25sp"
            android:typeface="sans"
            android:visibility="visible" />

        <ImageButton
            android:id="@+id/button2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="5dp"
            android:layout_weight=".33"
            android:textSize="25sp"
            android:typeface="sans"
            android:visibility="visible" />

        <ImageButton
            android:id="@+id/button3"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="5dp"
            android:layout_weight=".33"
            android:textSize="25sp"
            android:typeface="sans"
            android:visibility="visible" />
    </LinearLayout>

</LinearLayout>
于 2013-11-11T07:33:34.473 に答える