我想更改google-service-lib显示的对话框样式 然后让用户按是或否然后打开位置而不进行位置设置 我可以做吗 ?这个链接有这个对话框的例子,如果我可以如何改变它 How to show enable location dialog like Google maps?
答案 0 :(得分:0)
是。这是关于如何Create a Dialog Fragment:
的代码段public class FireMissilesDialogFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the Builder class for convenient dialog construction
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(R.string.dialog_fire_missiles)
.setPositiveButton(R.string.fire, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// FIRE ZE MISSILES!
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User cancelled the dialog
}
});
// Create the AlertDialog object and return it
return builder.create();
}
}
其他样本: