Fragments API
지원으로 애플리케이션을 다시 작성하고 있습니다. 원래 응용 프로그램에서 나는 다음과 같이 생성되는 AlertDialog
있습니다DialogFragment : 맞춤 레이아웃으로 AlertDialog 사용하기
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.button_dialog, null);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(view);
ListView mListView = (ListView) view.findViewById(R.id.mblist);
builder.setTitle(getString(R.string.sysinfo)).setNeutralButton(
getString(R.string.okay), null);
Cursor dcursor = propManager.propCursor();
if (dcursor.moveToFirst()) {
startManagingCursor(dcursor);
String[] from = { Constants.NAME_DET,
Constants.VALUE_DET };
int[] to = { R.id.mbname, R.id.mbvalue };
SimpleCursorAdapter dadapter = new SimpleCursorAdapter(this,
R.layout.info_list_row, dcursor, from, to);
mListView.setAdapter(dadapter);
}
final Dialog dialog = builder.create();
dialog.show();
가 어떻게이 DialogFragment를 통해 같은 대화 상자를 표시 할 수 있습니까? 나는이 문서를 읽었지만 이것을 계속하는 방법을 알아 내는데 어려움을 겪고있다.
이것은 많은 도움이되었습니다. 감사. – BruceHill
시스템 서비스를 호출하고 캐스팅하는 대신 getActivity(). getLayoutInflater()를 사용 하시겠습니까? –
굉장한 대답. 호기심이 생길 경우를 대비하여 [문서에서 다룹니다.] (https://developer.android.com/reference/android/app/DialogFragment.html). – Project