2016-07-22 4 views
0

私は活動中にフッターを持っています。このフッターが含まれています。エディットテキストの下に位置するエディットテキストとラジオグループ。フッタのフッターのようなもの。 基本的に私は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からフォーカスを削除しようとしましたが、アクティビティの入力中にソフトキーボードが表示されます。誰もがこの問題を解決する方法に関するアイデアを持っている場合、助けていただければ幸いです。

+0

キーボードが表示されているとき、アンドロイドはフォーカスのあるコントロールまで押すだけです。あなたのラジオボタンはレイアウト内の別々のコントロールであり、キーボードの上に押されることはありません。ほとんどのチャットアプリケーションがキーボードタイプを変更するのと同じように、編集コントロールの左側にトグルボタンを使用することができます。 – chejaras

答えて

1

xmlレイアウトにアクティビティが含まれているマニフェストXMLを変更するには、次のコードを使用します。これが役立つ| "adjustResize adjustPan" マニフェストファイルの

変更

<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name="com.example.adjustscroll.MainActivity" 
     android:label="@string/app_name" 
     android:windowSoftInputMode="stateUnchanged|adjustResize" 
     > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
</application> 

希望windowSoftInputMode =:|:

アンドロイドwindowSoftInputMode = "stateUnchanged adjustResize"

OR

アンドロイド君は。解決すれば教えてください。

+0

xamarinのwindowsoftinputmodeに複数のパラメータを渡す方法がわかりませんか? –

+0

私はWindow.SetSoftInputMode(SoftInput.StateAlwaysHidden)を使わなくても、キーボードのポップアップを入力時に防ぐことができると思います。その方法が機能した問題 –

+0

を修正します。乾杯 –

関連する問題