本文整理匯總了Java中android.widget.EditText.setEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java EditText.setEnabled方法的具體用法?Java EditText.setEnabled怎麽用?Java EditText.setEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.EditText
的用法示例。
在下文中一共展示了EditText.setEnabled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUIBusy
import android.widget.EditText; //導入方法依賴的package包/類
private void setUIBusy(Boolean busy) {
Button btnSearch = (Button) findViewById(R.id.btnSearch);
EditText txtKeyword = (EditText) findViewById(R.id.txtKeyword);
// Enable / disable
btnSearch.setEnabled(!busy);
txtKeyword.setEnabled(!busy);
// Spinner
ProgressBar pbSearch = (ProgressBar) findViewById(R.id.pbSearch);
if (busy) {
pbSearch.setVisibility(View.VISIBLE);
} else {
pbSearch.setVisibility(View.INVISIBLE);
}
}
示例2: onCreate
import android.widget.EditText; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.em_activity_edit);
editText = (EditText) findViewById(R.id.edittext);
String title = getIntent().getStringExtra("title");
String data = getIntent().getStringExtra("data");
Boolean editable = getIntent().getBooleanExtra("editable", false);
if(title != null)
((TextView)findViewById(R.id.tv_title)).setText(title);
if(data != null)
editText.setText(data);
editText.setEnabled(editable);
editText.setSelection(editText.length());
findViewById(R.id.btn_save).setEnabled(editable);
}
示例3: defaultAction
import android.widget.EditText; //導入方法依賴的package包/類
public boolean defaultAction(View view) {
TextView gameStatus = (TextView) findViewById(R.id.gameStatusView);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
EditText editText = (EditText) findViewById(R.id.editText);
TextView resultView = (TextView) findViewById(R.id.resultView);
if (currentWord != null) {
currentWord = dictionary.pickGoodStarterWord();
anagrams = dictionary.getAnagrams(currentWord);
gameStatus.setText(Html.fromHtml(String.format(START_MESSAGE, currentWord.toUpperCase(), currentWord)));
fab.setImageResource(android.R.drawable.ic_menu_help);
fab.hide();
resultView.setText("");
editText.setText("");
editText.setEnabled(true);
editText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
} else {
editText.setText(currentWord);
editText.setEnabled(false);
fab.setImageResource(android.R.drawable.ic_media_play);
currentWord = null;
resultView.append(TextUtils.join("\n", anagrams));
gameStatus.append(" Hit 'Play' to start again");
}
return true;
}
示例4: onCreate
import android.widget.EditText; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_remote_provisioning_login);
login = (EditText) findViewById(R.id.assistant_username);
password = (EditText) findViewById(R.id.assistant_password);
domain = (EditText) findViewById(R.id.assistant_domain);
connect = (Button) findViewById(R.id.assistant_connect);
connect.setOnClickListener(this);
String defaultDomain = getIntent().getStringExtra("Domain");
if (defaultDomain != null) {
domain.setText(defaultDomain);
domain.setEnabled(false);
}
mListener = new LinphoneCoreListenerBase(){
@Override
public void configuringStatus(LinphoneCore lc, final LinphoneCore.RemoteProvisioningState state, String message) {
if (state == LinphoneCore.RemoteProvisioningState.ConfiguringSuccessful) {
//TODO
} else if (state == LinphoneCore.RemoteProvisioningState.ConfiguringFailed) {
Toast.makeText(RemoteProvisioningLoginActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show();
}
}
};
}
示例5: updateEnabledState
import android.widget.EditText; //導入方法依賴的package包/類
/**
* Disable views ahead of current focus, so a selector can change the drawing of those views.
*/
private void updateEnabledState() {
int currentTag = Math.max(0, getIndexOfCurrentFocus());
for (int index = 0; index < editTextList.size(); index++) {
EditText editText = editTextList.get(index);
editText.setEnabled(index <= currentTag);
}
}
示例6: onCreateDialog
import android.widget.EditText; //導入方法依賴的package包/類
@NonNull
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final LayoutInflater inflater = LayoutInflater.from(getActivity());
// Read button configuration
final Bundle args = getArguments();
final int index = args.getInt(ARG_INDEX);
final String command = args.getString(ARG_COMMAND);
final int eol = args.getInt(ARG_EOL);
final int iconIndex = args.getInt(ARG_ICON_INDEX);
final boolean active = true; // change to active by default
mActiveIcon = iconIndex;
// Create view
final View view = inflater.inflate(R.layout.feature_uart_dialog_edit, null);
final EditText field = mField = (EditText) view.findViewById(R.id.field);
final GridView grid = (GridView) view.findViewById(R.id.grid);
final CheckBox checkBox = mActiveCheckBox = (CheckBox) view.findViewById(R.id.active);
checkBox.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
field.setEnabled(isChecked);
grid.setEnabled(isChecked);
if (mIconAdapter != null)
mIconAdapter.notifyDataSetChanged();
}
});
final RadioGroup eolGroup = mEOLGroup = (RadioGroup) view.findViewById(R.id.uart_eol);
switch (Command.Eol.values()[eol]) {
case CR_LF:
eolGroup.check(R.id.uart_eol_cr_lf);
break;
case CR:
eolGroup.check(R.id.uart_eol_cr);
break;
case LF:
default:
eolGroup.check(R.id.uart_eol_lf);
break;
}
field.setText(command);
field.setEnabled(active);
checkBox.setChecked(active);
grid.setOnItemClickListener(this);
grid.setEnabled(active);
grid.setAdapter(mIconAdapter = new IconAdapter());
// As we want to have some validation we can't user the DialogInterface.OnClickListener as it's always dismissing the dialog.
final AlertDialog dialog = new AlertDialog.Builder(getActivity()).setCancelable(false).setTitle(R.string.uart_edit_title).setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null).setView(view).show();
final Button okButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
okButton.setOnClickListener(this);
return dialog;
}
示例7: onCreate
import android.widget.EditText; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
overrideSwipeFromAnywhere();
super.onCreate(savedInstanceState);
applyColorTheme();
setContentView(R.layout.activity_createcategory);
setupAppBar(R.id.toolbar, "", true, true);
title = (EditText) findViewById(R.id.name);
feeds = new ArrayList<>();
if (getIntent().hasExtra(EXTRA_MULTI)) {
String multi = getIntent().getExtras().getString(EXTRA_MULTI);
title.setText(multi.replace("%20", " "));
title.setEnabled(false);
base = Realm.getDefaultInstance().where(Category.class).equalTo("name", multi).findFirst();
for (Feed f : base.getFeeds()) {
feeds.add(f);
}
}
recyclerView = (RecyclerView) findViewById(R.id.subslist);
ArrayList<FeedWrapper> allFeeds = new ArrayList<>();
for (FeedWrapper w : UserFeeds.getAllUserFeeds()) {
if (w instanceof Feed) {
allFeeds.add(w);
}
}
adapter = new CustomAdapter(allFeeds);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
}
示例8: onCreate
import android.widget.EditText; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setTitle("====== " + getString(R.string.config_polar_title) + " ======"); // title should not be too short, otherwise, dialog will be too narrow.
EditText edtXFrom = (EditText)findViewById(R.id.x_from_edit);
edtXFrom.setText("0");
edtXFrom.setEnabled(false);
EditText edtXTo = (EditText)findViewById(R.id.x_to_edit);
edtXTo.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
TextView tvXInputNote = (TextView)findViewById(R.id.x_input_note);
tvXInputNote.setText(getString(R.string.polar_chart_r_range_note));
TextView tvYInputNote = (TextView)findViewById(R.id.y_input_note);
tvYInputNote.setText(getString(R.string.polar_chart_angle_range_note) + " " + getString(R.string.degree) + ".");
}
示例9: hideEditText
import android.widget.EditText; //導入方法依賴的package包/類
private void hideEditText(EditText ... editTexts)
{
for (EditText anEditText : editTexts)
{
anEditText.setEnabled(false);
anEditText.setClickable(false);
anEditText.setVisibility(View.GONE);
}
}
示例10: showEditText
import android.widget.EditText; //導入方法依賴的package包/類
/**
*
* @param editTexts edits text we want to show
*/
private void showEditText(EditText ... editTexts)
{
for (EditText anEditText : editTexts)
{
anEditText.setEnabled(true);
anEditText.setClickable(true);
anEditText.setVisibility(View.VISIBLE);
}
}
示例11: hideEditText
import android.widget.EditText; //導入方法依賴的package包/類
/**
*
* @param editTexts editText we want to display
*/
private void hideEditText(EditText ... editTexts)
{
for (EditText anEditText : editTexts)
{
anEditText.setEnabled(false);
anEditText.setClickable(false);
anEditText.setVisibility(View.GONE);
}
}
示例12: onCreate
import android.widget.EditText; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_text_editor);
MainUtils.closeActionBarButton(this);
if (getSupportActionBar()!=null) {
getSupportActionBar().setTitle("Editor");
}
mEditText=(EditText) findViewById(R.id.editor_area);
mProgressDialog =new ProgressDialog(this);
mlength=mEditText.getText().length();
mkeylistener=mEditText.getKeyListener();
mEditText.setKeyListener(null);
mEditText.setEnabled(false);
String path=getIntent().getExtras().getString(CommonConstants.TEXTEDITACT_PARAM_PATH);
if(path!=null){
mFile=new File(path);
if(mFile.isDirectory()){
isNewFile=true;
mPath=mFile.getAbsolutePath();
}else{
mPath=path;
Log.d(TAG, "onCreate: file path is: "+path);
new FileOpenTask().execute();
}
}
}
示例13: prepareUI
import android.widget.EditText; //導入方法依賴的package包/類
private void prepareUI(String shareUri) {
mSharePathEditText = (EditText) findViewById(R.id.share_path);
mUsernameEditText = (EditText) findViewById(R.id.username);
mDomainEditText = (EditText) findViewById(R.id.domain);
mPasswordEditText = (EditText) findViewById(R.id.password);
CheckBox passwordCheckbox = (CheckBox) findViewById(R.id.needs_password);
mPinShareCheckbox = (CheckBox) findViewById(R.id.pin_share);
mSharePathEditText.setText(shareUri);
mSharePathEditText.setEnabled(false);
passwordCheckbox.setVisibility(View.GONE);
mPinShareCheckbox.setVisibility(View.VISIBLE);
Button mLoginButton = (Button) findViewById(R.id.mount);
mLoginButton.setText(getResources().getString(R.string.login));
mLoginButton.setOnClickListener(mLoginListener);
final Button cancel = (Button) findViewById(R.id.cancel);
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
示例14: setEnabled
import android.widget.EditText; //導入方法依賴的package包/類
/**
* 不可編輯
*
* @param editTexts
*/
public static void setEnabled(boolean enabled, EditText... editTexts) {
for (EditText e : editTexts) {
e.setEnabled(enabled);
}
}
示例15: disableEditText
import android.widget.EditText; //導入方法依賴的package包/類
public static void disableEditText(EditText editText){
editText.setFocusable(false);
editText.setEnabled(false);
editText.setFocusableInTouchMode(false);
}