【问题标题】:Can i change dailog style which let user to enable location我可以更改让用户启用位置的 dailog 样式吗
【发布时间】:2016-05-12 06:52:42
【问题描述】:

我想更改 google-service-lib 显示的对话框样式 并让用户按是或否然后打开位置而不转到位置设置 我可以做吗 ?如果可以的话,此链接有此对话框的示例,我该如何更改它 How to show enable location dialog like Google maps?

【问题讨论】:

  • 只需要自定义对话框

标签: android google-maps google-play-services


【解决方案1】:

是的。这是一个关于如何Create a Dialog Fragment的代码sn-p:

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();
    }
}

其他示例:

【讨论】:

  • 不,我不需要如何创建自定义对话框我想修改位置对话框
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-11-25
  • 1970-01-01
  • 2021-04-22
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多