當前位置: 首頁>>代碼示例>>Java>>正文


Java AlertDialog.getButton方法代碼示例

本文整理匯總了Java中android.app.AlertDialog.getButton方法的典型用法代碼示例。如果您正苦於以下問題:Java AlertDialog.getButton方法的具體用法?Java AlertDialog.getButton怎麽用?Java AlertDialog.getButton使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.app.AlertDialog的用法示例。


在下文中一共展示了AlertDialog.getButton方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showDisconnectDialog

import android.app.AlertDialog; //導入方法依賴的package包/類
private void showDisconnectDialog()
{

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(R.string.title_cancel);
    builder.setMessage(R.string.cancel_connection_query);
    builder.setNegativeButton(android.R.string.no, this);
    builder.setPositiveButton(android.R.string.yes, this);
    builder.setOnCancelListener(this);
    builder.show();

    AlertDialog alert11 = builder.create();
    alert11.show();

    Button buttonbackground = alert11.getButton(DialogInterface.BUTTON_NEGATIVE);
    buttonbackground.setTextColor(Color.RED);

    Button buttonbackground1 = alert11.getButton(DialogInterface.BUTTON_POSITIVE);
    buttonbackground1.setTextColor(Color.RED);
}
 
開發者ID:akashdeepsingh9988,項目名稱:Cybernet-VPN,代碼行數:21,代碼來源:DisconnectVPNActivity.java

示例2: getEditTextDialog

import android.app.AlertDialog; //導入方法依賴的package包/類
public AlertDialog getEditTextDialog(Context context, String title, final OnClickOkBtnListener mOnClickOkBtnListener) {
    this.mContext = context;
    et = (EditText) LayoutInflater.from(context).inflate(R.layout.layout_edittext, null);
    et.setSingleLine(true);
    AlertDialog mAlertDialog = new AlertDialog.Builder(mContext).setTitle(title)
            .setView(et)
            .setPositiveButton(mContext.getString(R.string.ok), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    String input = et.getText().toString();
                    if (null != mOnClickOkBtnListener) {
                        mOnClickOkBtnListener.onClickOk(input);
                    }

                }
            })
            .setNegativeButton(mContext.getString(R.string.cancel), null).show();
    Button btn1 = mAlertDialog.getButton(mAlertDialog.BUTTON_POSITIVE);
    btn1.setTextColor(context.getResources().getColor(R.color.colorPrimary));
    Button btn2 = mAlertDialog.getButton(mAlertDialog.BUTTON_NEGATIVE);
    btn2.setTextColor(context.getResources().getColor(R.color.colorPrimary));
    return mAlertDialog;
}
 
開發者ID:Datatellit,項目名稱:xlight_android_native,代碼行數:23,代碼來源:DialogUtils.java

示例3: getConfirmCancelDialog

import android.app.AlertDialog; //導入方法依賴的package包/類
/**
 * @param context
 * @param title
 * @param mOnClickOkBtnListener
 * @return
 */
public AlertDialog getConfirmCancelDialog(Context context, String title, final OnClickOkBtnListener mOnClickOkBtnListener) {
    this.mContext = context;
    AlertDialog mAlertDialog = new AlertDialog.Builder(mContext).setTitle(title)
            .setPositiveButton(mContext.getString(R.string.ok), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    if (null != mOnClickOkBtnListener) {
                        if (null == et) {
                            mOnClickOkBtnListener.onClickOk(null);
                        } else {
                            String input = et.getText().toString();
                            mOnClickOkBtnListener.onClickOk(input);
                        }
                    }

                }
            })
            .setNegativeButton(mContext.getString(R.string.cancel), null).show();
    Button btn1 = mAlertDialog.getButton(mAlertDialog.BUTTON_POSITIVE);
    btn1.setTextColor(context.getResources().getColor(R.color.colorPrimary));
    Button btn2 = mAlertDialog.getButton(mAlertDialog.BUTTON_NEGATIVE);
    btn2.setTextColor(context.getResources().getColor(R.color.colorPrimary));
    return mAlertDialog;
}
 
開發者ID:Datatellit,項目名稱:xlight_android_native,代碼行數:30,代碼來源:DialogUtils.java

示例4: setTypeface

import android.app.AlertDialog; //導入方法依賴的package包/類
private static void setTypeface(TypefaceHelper helper, AlertDialog alertDialog, String typefaceName, int style) {
	Button positive = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
	Button negative = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
	Button neutral = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
	TextView message = (TextView) alertDialog.findViewById(android.R.id.message);
	if (positive != null) {
		helper.setTypeface(positive, typefaceName, style);
	}
	if (negative != null) {
		helper.setTypeface(negative, typefaceName, style);
	}
	if (neutral != null) {
		helper.setTypeface(neutral, typefaceName, style);
	}
	if (message != null) {
		helper.setTypeface(message, typefaceName, style);
	}
}
 
開發者ID:geeknat,項目名稱:spinify_android,代碼行數:19,代碼來源:DialogUtils.java

示例5: onStart

import android.app.AlertDialog; //導入方法依賴的package包/類
@Override public void onStart() {
  super.onStart();
  AlertDialog dialog = (AlertDialog) getDialog();

  // http://stackoverflow.com/a/16972670/1048340
  //noinspection ConstantConditions
  dialog.getWindow()
      .clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
  dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);

  // Do not dismiss the dialog when clicking the neutral button.
  Button neutralButton = dialog.getButton(AlertDialog.BUTTON_NEUTRAL);
  if (neutralButton != null) {
    neutralButton.setOnClickListener(new View.OnClickListener() {
      @Override public void onClick(View v) {
        rootView.removeAllViews();
        switch (dialogType) {
          case TYPE_CUSTOM:
            dialogType = TYPE_PRESETS;
            ((Button) v).setText(R.string.cpv_custom);
            rootView.addView(createPresetsView());
            break;
          case TYPE_PRESETS:
            dialogType = TYPE_CUSTOM;
            ((Button) v).setText(R.string.cpv_presets);
            rootView.addView(createPickerView());
        }
      }
    });
  }
}
 
開發者ID:Blankeer,項目名稱:MDWechat,代碼行數:32,代碼來源:ColorPickerDialog.java

示例6: validateAndUpdateButton

import android.app.AlertDialog; //導入方法依賴的package包/類
private void validateAndUpdateButton() {
    AlertDialog d = (AlertDialog) getDialog();

    if (d != null) {
        Button button = d.getButton(AlertDialog.BUTTON_POSITIVE);

        if (button != null) {
            button.setEnabled(isValid());
        }
    }
}
 
開發者ID:orgzly,項目名稱:orgzly-android,代碼行數:12,代碼來源:StatesPreference.java

示例7: prepareDialog

import android.app.AlertDialog; //導入方法依賴的package包/類
public void prepareDialog(Dialog dialog, ItemDesc ctxItem)
{
    if(aa == null)
    {
        Log.e(L.TAG, "MoveToAction.prepareDialog() called before createDialog()");
        return;
    }
    

    ListDesc selectedListDesc = dataViewer.getSelectedList();
    dataViewList.clear();
    dataViewList.addAll(dataViewer.getListData());
    dataViewList.remove(selectedListDesc);
    
    aa.clear();
    int selectedId = selectedListDesc.getId();
    for(int i = 0; i < dataViewList.size(); i++)
    {
        ListDesc listDesc = dataViewList.get(i);
        if(listDesc.getId() != selectedId)
        {
            aa.add(listDesc.getLabel());
        }
    }
    
    aa.notifyDataSetChanged();
    
    AlertDialog alertDialog = (AlertDialog)dialog;
    okButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
    okButton.setEnabled(selectedItem != null);
    
    this.ctxItem = ctxItem;
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:34,代碼來源:MoveToAction.java

示例8: doChangeDialogFontColor

import android.app.AlertDialog; //導入方法依賴的package包/類
private static void doChangeDialogFontColor(AlertDialog dialog) {
    int piblue = dialog.getContext().getResources().getColor(PIBLUE);
    if (dialog.getButton(AlertDialog.BUTTON_NEGATIVE) != null) {
        dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(piblue);
    }

    if (dialog.getButton(AlertDialog.BUTTON_NEUTRAL) != null) {
        dialog.getButton(AlertDialog.BUTTON_NEUTRAL).setTextColor(piblue);
    }

    if (dialog.getButton(AlertDialog.BUTTON_POSITIVE) != null) {
        dialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(piblue);
    }
}
 
開發者ID:privacyidea,項目名稱:privacyidea-authenticator,代碼行數:15,代碼來源:MainActivity.java

示例9: showDialog

import android.app.AlertDialog; //導入方法依賴的package包/類
@Override
protected void showDialog(Bundle state) {
    super.showDialog(state);
    getEditText().setError(null);
    final AlertDialog dialog = (AlertDialog) getDialog();
    View positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
    positiveButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onPositiveButtonClicked();
        }
    });
}
 
開發者ID:bfabiszewski,項目名稱:ulogger-android,代碼行數:14,代碼來源:UrlEditTextPreference.java


注:本文中的android.app.AlertDialog.getButton方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。