2017-08-06 17 views
1

編集用のテキストのために私のAndroidアプリケーションのカスタムダイアログを使用しようとしています。私はキーボードの上にショーの対話をしたい。私は半分の対話をキーボードの下に隠しています。私はそれのための解決策を見つけることができません。誰かがこのパズルを解くのに役立つ場合は、私に教えてください。対話のための私のJavaコードのようなキーボードのAndroidでのカスタムダイアログ

final Dialog dialog = new Dialog(NameArt.this,R.style.Theme_Dialog); 
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 
    dialog.setContentView(R.layout.lyt_dialog_updatename); 
    //dialog.getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT); 
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); 

とXMLを下回っている

<?xml version="1.0" encoding="utf-8"?> 
 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
 
    android:layout_width="fill_parent" 
 
    android:layout_height="wrap_content"> 
 

 
    <EditText 
 
     android:id="@+id/edstikertext" 
 
     android:layout_width="match_parent" 
 
     android:layout_height="match_parent" 
 
     android:gravity="center" 
 
     android:layout_above="@+id/btncancel" 
 
     android:hint="Enter text hear" /> 
 

 
    <Button 
 
     android:id="@+id/btncancel" 
 
     android:layout_width="wrap_content" 
 
     android:layout_height="wrap_content" 
 
     android:layout_alignParentLeft="true" 
 
     android:layout_alignParentStart="true" 
 
     android:layout_marginRight="5dp" 
 
     android:layout_alignParentBottom="true" 
 
     android:layout_marginEnd="5dp" 
 
     android:background="@drawable/boder" 
 
     android:layout_marginTop="5dp" 
 
     android:text=" Cancel " /> 
 

 
    <Button 
 
     android:background="@drawable/boder" 
 
     android:layout_alignParentRight="true" 
 
     android:layout_alignParentEnd="true" 
 
     android:id="@+id/btnok" 
 
     android:layout_width="wrap_content" 
 
     android:layout_height="wrap_content" 
 
     android:layout_alignParentBottom="true" 
 
     android:layout_marginRight="5dp" 
 
     android:layout_marginEnd="5dp" 
 
     android:layout_marginTop="5dp" 
 
     android:text=" OK " /> 
 

 
</RelativeLayout>

以下のようなもので、私のスタイルは

<style name="Theme_Dialog" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <item name="android:windowMinWidthMajor">100%</item> 
    <item name="android:windowMinWidthMinor">100%</item> 
</style> 
以下のようなものです

私はキーボード上で対話をしたいが、それは完全な高さになっている。おかげ

答えて

1

は、私はちょうどそれがによってショーの対話の前に次の行を追加

dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); 

おかげ

を解決しました
関連する問題