私は活動中にフッターを持っています。このフッターが含まれています。エディットテキストの下に位置するエディットテキストとラジオグループ。フッタのフッターのようなもの。 基本的に私はradiogroupを使ってキーボードタイプ(絵文字キーボードまたは普通のキーボード)を選択します。 xmlは以下のとおりです。フッターが添付されたeditdtext。 edittextがフォーカスを取得すると、フッターがsoftinputkeyboardの下に消えます
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textbase_layout"
android:background="@color/appwhite">
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@color/window_background"
android:layout_alignParentTop="true" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxHeight="80dp"
android:id="@+id/comment_txt"
android:layout_marginTop="8dp"
android:textColorHint="@color/comment_header_grey"
android:hint="message goes here"
android:background="@android:color/transparent"
android:padding="5dp"
android:focusable="true"
android:layout_marginLeft="10dp"
android:layout_centerVertical="true"
android:layout_marginRight="10dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/appwhite"
android:layout_below="@id/textbase_layout">
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:orientation="horizontal">
<RadioButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/keyboard_btn"
android:padding="8dp"
android:textColor="@drawable/selector_text_radio"
android:button="@drawable/keyboard_icon_selector"
android:layout_marginRight="5dp" />
<RadioButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/emoji_btn"
android:padding="8dp"
android:textColor="@drawable/selector_text_radio"
android:button="@drawable/smiley_icon_selector"
android:layout_marginLeft="5dp" />
</RadioGroup>
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/send_btn"
android:text="Send"
android:textColor="@color/bcg_blue"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@android:color/transparent" />
</RelativeLayout>
</RelativeLayout>
私はWindowSoftInputMode = SoftInput.AdjustResizeも設定しています。 edittextを選択すると、フッタ全体がプッシュアップされます。ラジオグループを含む。しかし、これは起こっていない場合もあります。下部の放射線グループは、ソフトキーボードによって切断されています。私がoncreate()メソッドでこの行を実行するとき。
Window.SetSoftInputMode(SoftInput.StateAlwaysHidden);
私は上記の行をコメントアウトしてください。 radiogroupは常に表示されますが、最初にアクティビティが開かれたときにソフトキーボードがポップアップするという別の望ましくない状態が発生していますか? Iveはこのシチュエーションでもedittextからフォーカスを削除しようとしましたが、アクティビティの入力中にソフトキーボードが表示されます。誰もがこの問題を解決する方法に関するアイデアを持っている場合、助けていただければ幸いです。
キーボードが表示されているとき、アンドロイドはフォーカスのあるコントロールまで押すだけです。あなたのラジオボタンはレイアウト内の別々のコントロールであり、キーボードの上に押されることはありません。ほとんどのチャットアプリケーションがキーボードタイプを変更するのと同じように、編集コントロールの左側にトグルボタンを使用することができます。 – chejaras