2017-12-20 24 views
0

내 대화 상자는 화면 중앙에 있으며 3 개의 텍스트 편집 및 버튼이 있습니다. 첫 번째 편집 텍스트에 중점을두면 전체 대화 상자가 키보드 상단에 표시되어 대화 상자 아래쪽에 내 단추가 표시됩니다. 나는 거의 alll 여기에 답변을 시도 키보드 상단의 대화 상자

..

var dialog = builder.create() 

dialog.window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN) 

return dialog 

참고 :.?이 그냥 대화, 그래서 매니페스트에 뭔가를 넣어 필요가 없습니다입니다 ..

내가 대화로이 있다고 가정 할 수 있습니다 ---->i47.tinypic.com/2vchnih.png

나는 나의 대화는 키보드의 상단에이 같은 NOT 뭔가 ---->i45.tinypic.com/352lym9.png

답변

0

이 경우에는 전체 화면 대화 상자가 필요합니다. 대화 상자의 테마를로 설정하십시오.

<style name="fullScreeDialog"> 
    <item name="android:windowFrame">@null</item> 
    <item name="android:windowIsFloating">true</item> 
    <item name="android:windowContentOverlay">@null</item> 
    <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item> 
    <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item> 
</style> 

Xml 레이아웃.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 
<LinearLayout 
    android:id="@+id/footer" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:background="@color/blue_end" 
    android:gravity="center" 
    android:orientation="vertical" 
    android:paddingBottom="30dp"> 

    <EditText 
     android:id="@+id/et1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:padding="20dp" 
     android:text="hint" /> 
</LinearLayout> 

그런 다음 match_parent 창 PARAMS와 대화를 구축 할 수 있습니다.

private void buildDialog() { 
     Dialog dialog=new Dialog(this,R.style.fullScreeDialog); 
     dialog.setContentView(R.layout.item_dialog); 
     WindowManager.LayoutParams params = dialog.getWindow().getAttributes(); 
     params.width = WindowManager.LayoutParams.MATCH_PARENT; 
     params.height = WindowManager.LayoutParams.MATCH_PARENT; 
     dialog.getWindow().setAttributes(params); 
     dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); 
     dialog.show(); 
    } 

출력이 - Output

+0

으로 초점을 볼 수있게 표시됩니다. 시도해 보겠습니다. btw, 전체 화면 대화 상자는 무엇을합니까? – xigncode23

+0

editttext가 표시되지만 해당 편집 텍스트의 맨 아래에 버튼이 있습니다. 그리고 키보드를 호출 한 후에 버튼을 표시하길 원합니다 ... – xigncode23

+0

이것은 합법적이지만 나에게 효과가 없었던 것 같습니다. – xigncode23

0

또한,이 코드를 시도되고 싶어요 너비와 높이를 수동으로 설정해야합니다.

WindowManager.LayoutParams params = window.getAttributes(); 
     params.width = WindowManager.LayoutParams.MATCH_PARENT; 
     params.height = WindowManager.LayoutParams.MATCH_PARENT; 
     params.gravity = Gravity.CENTER; 
     window.setAttributes(params); 
     window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); 
+0

난 그냥 노력이 ----> https://stackoverflow.com/questions/12189776/how-can-i-display-a-dialog- 키보드 위 화면에 대화 상자가 제한되어있는 것처럼 보입니다. – xigncode23

+0

당신은 첨부 할 수 있습니다 당신이 – ABDevelopers

+0

를 원하는의 스크린 샷은 내가 대화로이 있다고 가정 할 수 있습니다 ----> http://i47.tinypic.com/2vchnih.png 나는 키보드의 TOP에있을 나의 대화를 원하는 NOT this like -----> http://i45.tinypic.com/352lym9.png – xigncode23

관련 문제