안드로이드 dialog에서 Editview가 안되나요??
버튼을 클릭하면 dialog를 뛰워서 Editview에다 글을 쓰고 확인을 누르면 그 정보가 다시 버튼 제목에 들어가게 하는 것을 하고 싶습니다.
버튼같은 것은 되는데, editview만 안되네요 ㅠㅠ 엉 ㅠㅠ
오류 나네요.. ㅠㅠ 왜 그러는지 전혀 모르겠습니다.
public void onClick(View v) {
Dialog d=new Dialog(Tab1.this);
Window window=d.getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
d.setTitle("시간표 입력");
d.setContentView(R.layout.intent);
d.show();
}
그냥 간단한 불어오기구요
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/yes">
</Button>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/no">
</Button>
<EditView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</EditView>
</LinearLayout>
여기서 editview를 빼면 그냥 뜨지만 , 넣으면 바로 오류 뜹니다.
왜 그렇죠? 그냥 dialog에서는 editview자체가 안되나요?? 답답하네요 해결책좀 부탁드리겠습니다. ㅠㅠ
... 아 그리고 dialog는 크기 조절 안되나요??
.
제가 쓰고있는 코드의 일부분 이지만 도움이 될려나 ...
얼럿 다이얼로그를 인필트 해서 edittext 에서 값을 얻어어오고 백키와 취소키에대한 처리를 햇습니다 .
LayoutInflater factory_DIA_PAY= LayoutInflater.from(this);
final View PAY_ET_INPUT = factory_DIA_PAY.inflate(R.layout.inputbox, null);
final EditText ET_PAY_INPUT = (EditText)PAY_ET_INPUT.findViewById(R.id.EditText_INPUTBOX);
ET_PAY_INPUT.setInputType(InputType.TYPE_CLASS_NUMBER);
ET_PAY_INPUT.setFilters(new InputFilter[]{
new InputFilter.LengthFilter(6),
});
return new AlertDialog.Builder(work.this)
.setTitle("금액입력")
.setView(PAY_ET_INPUT)
.setPositiveButton("확인", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
INPUT_PAY = ET_PAY_INPUT.getText().toString();
if(BO_BARCODE_BOTTOM){
work = W_BARCODE_BOTTOM;
ET_BARCODE_BOTTOM.setText("");
TV_PAY.setText(INPUT_PAY);
}else{
work = W_BARCODE;
TV_PAY.setText(INPUT_PAY);
}
}
})
.setNegativeButton("취소", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
if(BO_INSUJA){
work = W_INSUJA;
showDialog(DIA_INSUJA);
}else if(BO_JUNGSAN){
work = W_JUNGSAN;
showDialog(DIA_JUNGSAN);
}
}
})
.setOnCancelListener(new OnCancelListener() {// 취소처리
@Override
public void onCancel(DialogInterface dialog) {
if(BO_INSUJA){
work = W_INSUJA;
showDialog(DIA_INSUJA);
}else if(BO_JUNGSAN){
work = W_JUNGSAN;
showDialog(DIA_JUNGSAN);
}
}
})
.create();