<legend id='6rKE1'><style id='6rKE1'><dir id='6rKE1'><q id='6rKE1'></q></dir></style></legend>
      <i id='6rKE1'><tr id='6rKE1'><dt id='6rKE1'><q id='6rKE1'><span id='6rKE1'><b id='6rKE1'><form id='6rKE1'><ins id='6rKE1'></ins><ul id='6rKE1'></ul><sub id='6rKE1'></sub></form><legend id='6rKE1'></legend><bdo id='6rKE1'><pre id='6rKE1'><center id='6rKE1'></center></pre></bdo></b><th id='6rKE1'></th></span></q></dt></tr></i><div id='6rKE1'><tfoot id='6rKE1'></tfoot><dl id='6rKE1'><fieldset id='6rKE1'></fieldset></dl></div>
      <tfoot id='6rKE1'></tfoot>
        <bdo id='6rKE1'></bdo><ul id='6rKE1'></ul>

      <small id='6rKE1'></small><noframes id='6rKE1'>

      如何更改 ListPreference 对话框的外观

      时间:2023-08-30

      1. <legend id='pMQGV'><style id='pMQGV'><dir id='pMQGV'><q id='pMQGV'></q></dir></style></legend>
      2. <small id='pMQGV'></small><noframes id='pMQGV'>

          <bdo id='pMQGV'></bdo><ul id='pMQGV'></ul>
          <tfoot id='pMQGV'></tfoot>
          <i id='pMQGV'><tr id='pMQGV'><dt id='pMQGV'><q id='pMQGV'><span id='pMQGV'><b id='pMQGV'><form id='pMQGV'><ins id='pMQGV'></ins><ul id='pMQGV'></ul><sub id='pMQGV'></sub></form><legend id='pMQGV'></legend><bdo id='pMQGV'><pre id='pMQGV'><center id='pMQGV'></center></pre></bdo></b><th id='pMQGV'></th></span></q></dt></tr></i><div id='pMQGV'><tfoot id='pMQGV'></tfoot><dl id='pMQGV'><fieldset id='pMQGV'></fieldset></dl></div>
                  <tbody id='pMQGV'></tbody>

                本文介绍了如何更改 ListPreference 对话框的外观的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我想更改 ListPreference 对话框中出现的 RadioButton 以换取复选标记或其他内容,或者没有,有没有简单的方法可以做到这一点?

                I would like to change the RadioButton that appears on ListPreference dialog for a check mark or something different, or none, is there a simple way to do this?

                推荐答案

                如果你想改变整个对话框,也许可以使用像这样的替换对话框库 material-dialogs 包,你可以使用这个替换 ListPreference:

                If you want to change the whole dialog, maybe to use a replacement dialog library like this material-dialogs package, you can use this replacement ListPreference:

                import com.afollestad.materialdialogs.MaterialDialog;
                
                public class MaterialListPreference extends ListPreference {
                  private MaterialDialog.Builder mBuilder;
                  private Context context;
                
                  public MaterialListPreference(Context context) {
                    super(context);
                    this.context = context;
                  }
                
                  public MaterialListPreference(Context context, AttributeSet attrs) {
                    super(context, attrs);
                    this.context = context;
                  }
                
                  @Override
                  protected void showDialog(Bundle state) {
                    mBuilder = new MaterialDialog.Builder(context);
                    mBuilder.title(getTitle());
                    mBuilder.icon(getDialogIcon());
                    mBuilder.positiveText(null);
                    mBuilder.negativeText(getNegativeButtonText());
                    mBuilder.items(getEntries());
                    mBuilder.itemsCallback(new MaterialDialog.ListCallback() {
                      @Override
                      public void onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
                        onClick(null, DialogInterface.BUTTON_POSITIVE);
                        dialog.dismiss();
                
                        if (which >= 0 && getEntryValues() != null) {
                          String value = getEntryValues()[which].toString();
                          if (callChangeListener(value))
                            setValue(value);
                        }
                      }
                    });
                
                    final View contentView = onCreateDialogView();
                    if (contentView != null) {
                      onBindDialogView(contentView);
                      mBuilder.customView(contentView);
                    }
                    else
                      mBuilder.content(getDialogMessage());
                
                    mBuilder.show();
                  }
                
                }
                

                它做的不多,只是覆盖对话框显示和选择回调部分的最低限度.YMMV 如果您选择不同的对话框库但不会太多,它们往往或多或少是 AlertDialog 的直接替代品.

                It doesn't do much, just the bare minimum to override the dialog display and selection callback parts. YMMV very slightly if you opt for a different dialog library but not too much, they tend to be more or less direct replacements for AlertDialog.

                这篇关于如何更改 ListPreference 对话框的外观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:为什么 setCanceledOnTouchOutside(false) 在警报生成器中 下一篇:如何为自定义对话框添加标题?

                相关文章

                最新文章

              • <small id='le6es'></small><noframes id='le6es'>

                  <legend id='le6es'><style id='le6es'><dir id='le6es'><q id='le6es'></q></dir></style></legend>

                1. <tfoot id='le6es'></tfoot>

                    <bdo id='le6es'></bdo><ul id='le6es'></ul>
                  <i id='le6es'><tr id='le6es'><dt id='le6es'><q id='le6es'><span id='le6es'><b id='le6es'><form id='le6es'><ins id='le6es'></ins><ul id='le6es'></ul><sub id='le6es'></sub></form><legend id='le6es'></legend><bdo id='le6es'><pre id='le6es'><center id='le6es'></center></pre></bdo></b><th id='le6es'></th></span></q></dt></tr></i><div id='le6es'><tfoot id='le6es'></tfoot><dl id='le6es'><fieldset id='le6es'></fieldset></dl></div>