本文整理匯總了Java中android.widget.EditText.setKeyListener方法的典型用法代碼示例。如果您正苦於以下問題:Java EditText.setKeyListener方法的具體用法?Java EditText.setKeyListener怎麽用?Java EditText.setKeyListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.EditText
的用法示例。
在下文中一共展示了EditText.setKeyListener方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import android.widget.EditText; //導入方法依賴的package包/類
@Override
protected void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
penClient = PenClientCtrl.getInstance( getApplicationContext() );
if(penClient.getProtocolVersion() == 1)
addPreferencesFromResource( R.xml.pref_settings );
else
addPreferencesFromResource( R.xml.pref_settings2 );
mPasswordPref = (EditTextPreference) getPreferenceScreen().findPreference( Const.Setting.KEY_PASSWORD );
EditText myEditText = (EditText) mPasswordPref.getEditText();
myEditText.setKeyListener( DigitsKeyListener.getInstance( false, true ) );
}
示例2: setEditTextDisabled
import android.widget.EditText; //導入方法依賴的package包/類
private static void setEditTextDisabled(EditText editText) {
editText.setInputType(InputType.TYPE_NULL);
editText.setTextIsSelectable(true);
editText.setKeyListener(null);
editText.setBackgroundResource(R.drawable.edit_text_readonly);
int color = StyledAttributesHelper.getColor(editText.getContext(), android.R.attr.textColorSecondary, 0);
ViewCompat.setBackgroundTintList(editText, ColorStateList.valueOf(color));
((ViewGroup) editText.getParent()).setAddStatesFromChildren(false);
}
示例3: initViews
import android.widget.EditText; //導入方法依賴的package包/類
private void initViews() {
etPwd = (EditText)findViewById(R.id.pwd);
etInfo = (EditText)findViewById(R.id.info);
tvTip = (TextView)findViewById(R.id.tip);
tvErrorMsg = (TextView)findViewById(R.id.errorMsg);
btnOperate = (Button)findViewById(R.id.ok);
btnOperate.setOnClickListener(this);
//取得從上一個Activity傳遞過來的數據
bundle = this.getIntent().getExtras();
actBar.setTitle(bundle.getString(BAR_TITLE));
etInfo.setText(bundle.getString(INFO));
if (bundle.getBoolean(INFO_READONLY)){
etInfo.setKeyListener(null);
}else{
etInfo.setSelection(etInfo.getText().length());
}
strRegex = bundle.getString(REGEX);
tvTip.setText(bundle.getString(TIP));
btnOperate.setText(bundle.getString(OPERATE_TEXT));
//設置隱藏項
String strOperate = bundle.getString(OPERATE);
if (strOperate.equals(OPERATE_BIND_EMAIL) || strOperate.equals(OPERATE_BIND_PHONE)){
etPwd.setVisibility(View.VISIBLE);
}else{
etPwd.setVisibility(View.GONE);
}
}
示例4: ViewHolder
import android.widget.EditText; //導入方法依賴的package包/類
public ViewHolder(View itemView) {
super(itemView);
inputEmail = (EditText) itemView.findViewById(R.id.input_email);
inputEmail.setKeyListener(null);
checkBox = (CheckBox) itemView.findViewById(R.id.checkbox);
editButton = (ImageButton) itemView.findViewById(R.id.edit);
checkBox.setChecked(false);
}
示例5: 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();
}
}
}
示例6: setCardInput
import android.widget.EditText; //導入方法依賴的package包/類
public void setCardInput(Context context){
EditText input= ((EditText) findViewById(R.id.inputEdit));
input.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
input.setKeyListener(DigitsKeyListener.getInstance(context.getResources().getString(R.string.filter_vcode)));
}
示例7: onCreate
import android.widget.EditText; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.edit_activity);
String pathFile = getIntent().getStringExtra(Commons.pathFile);
TextView tv = (TextView) findViewById(R.id.notetitle);
tv.setTextColor(Color.WHITE);
tv.setText(""+pathFile);
//Get the text file
File file = new File(pathFile);
//Read text from file
StringBuilder text = new StringBuilder();
try {
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
while ((line = br.readLine()) != null) {
text.append(line);
text.append('\n');
}
br.close();
}
catch (IOException e) {
//You'll need to add proper error handling here
}
//Find the view by its id
EditText edit = (EditText) findViewById(R.id.note);
//Set the text
edit.setFocusable(false);
edit.setFocusableInTouchMode(false);
edit.clearFocus();
edit.setTag(edit.getKeyListener());
edit.setKeyListener(null);
edit.setText(text.toString());
edit.setTextColor(Color.DKGRAY);
}
示例8: onCreate
import android.widget.EditText; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pay_bill);
View decorView = getWindow().getDecorView();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
decorView.setSystemUiVisibility(option);
getWindow().setStatusBarColor(Color.TRANSPARENT);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window window = getWindow();
// Translucent status bar
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager
.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
Intent intent = getIntent();
final Bundle bundle = intent.getExtras();
vertifyView=(TextView)findViewById(R.id.timer);
final TextView money = (TextView)findViewById(R.id.textView3);
TextView name=(TextView)findViewById(R.id.textView4);
TextView phone = (TextView)findViewById(R.id.textView7);
TextView packSort= (TextView)findViewById(R.id.textView8);
TextView pickNum = (TextView)findViewById(R.id.textView9);
Button pickPlace=(Button)findViewById(R.id.button);
Button delieverPlace = (Button)findViewById(R.id.button2);
TextView pickTime =(TextView)findViewById(R.id.pick_time);
TextView delieverTime=(TextView)findViewById(R.id.deliever_time);
Button ensureBillBtn = (Button)findViewById(R.id.ensure_bill_btn);
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
toolbar.setTitle("確認支付");
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if(actionBar != null){
actionBar.setDisplayHomeAsUpEnabled(true);
}
timer.start();
EditText total = (EditText)findViewById(R.id.textView3);
total.setKeyListener(null);
String fetchTime = bundle.getString("pickuptime");
int index1 = fetchTime.indexOf('日');
fetchTime = "\t\t\t\t"+fetchTime.substring(0,index1+1)+" "+fetchTime.substring(index1+2);
String sendTime = bundle.getString("delievertime");
int index2 = sendTime.indexOf('日');
sendTime = "\t\t\t\t"+sendTime.substring(0,index2+1)+" "+sendTime.substring(index2+2);
if(bundle!=null){
money.setText("¥ "+bundle.getString("money"));
name.setText(bundle.getString("name"));
phone.setText(bundle.getString("phone"));
packSort.setText(bundle.getString("packsort"));
pickNum.setText(bundle.getString("num"));
pickPlace.setText(bundle.getString("pickupplace"));
delieverPlace.setText(bundle.getString("delieverplace"));
pickTime.setText(fetchTime);
delieverTime.setText(sendTime);
ensureBillBtn.setText("確認支付 ¥ "+bundle.getString("money"));
}
mPostInfoFormView = findViewById(R.id.pay_form);
mProgressView = findViewById(R.id.pay_progress);
ensureBillBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences sp = getSharedPreferences("now_account", Context.MODE_PRIVATE);
String stuNum = sp.getString("now_stu_num", null);
FetchUserInfo fetchUserInfo = new FetchUserInfo(stuNum);
fetchUserInfo.execute();
}
});
}