현재 DialogFragment와 함께 사용자 지정 레이아웃을 사용하려고하고 있지만 잘못된 것 같습니다. 긍정적/부정적 버튼 (제목과 함께) 보여DialogFragment onCreateView가 사용자 정의 레이아웃보기를 반환하지 않습니까?
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
setRetainInstance(true);
Log.d(TAG, "onCreateDialog");
return new AlertDialog.Builder(getActivity())
.setPositiveButton(android.R.string.ok, passDataListener)
.setNegativeButton(android.R.string.cancel, null)
.setCancelable(true)
.create();
}
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
Log.d(TAG, "onCreateView");
setTitleFromBundle();
return inflater.inflate(R.layout.dialog_edittext, container);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mEditText = (EditText) view.findViewById(R.id.dialog_edittext);
tvUnits = (TextView) view.findViewById(R.id.dialog_units);
setMaxCharsFromBundle();
setTextFromBundle();
setHintFromBundle();
setInputTypeFromBundle();
setUnitsTextViewFromBundle();
}
그러나, 내 배치하지 않는이 내 클래스는 현재 모습입니다.
대화 상자 조각을 사용하는 경우 왜 AlertDialog.Builder inOnCreate를 사용합니까? –