本文整理汇总了Java中android.widget.EditText.setTag方法的典型用法代码示例。如果您正苦于以下问题:Java EditText.setTag方法的具体用法?Java EditText.setTag怎么用?Java EditText.setTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.EditText
的用法示例。
在下文中一共展示了EditText.setTag方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateOneEditText
import android.widget.EditText; //导入方法依赖的package包/类
/**
* Takes care of styling the editText passed in the param.
* tag is the index of the editText.
*
* @param styleEditText
* @param tag
*/
private void generateOneEditText(EditText styleEditText, String tag) {
params.setMargins(mSplitWidth / 2, mSplitWidth / 2, mSplitWidth / 2, mSplitWidth / 2);
filters[0] = new InputFilter.LengthFilter(1);
styleEditText.setFilters(filters);
styleEditText.setLayoutParams(params);
styleEditText.setGravity(Gravity.CENTER);
styleEditText.setCursorVisible(mCursorVisible);
if (!mCursorVisible) {
styleEditText.setClickable(false);
styleEditText.setHint(mHint);
styleEditText.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
// When back space is pressed it goes to delete mode and when u click on an edit Text it should get out of the delete mode
mDelPressed = false;
return false;
}
});
}
styleEditText.setBackgroundResource(mPinBackground);
styleEditText.setPadding(0, 0, 0, 0);
styleEditText.setTag(tag);
styleEditText.setInputType(getKeyboardInputType());
styleEditText.addTextChangedListener(this);
styleEditText.setOnFocusChangeListener(this);
styleEditText.setOnKeyListener(this);
}
示例2: createEditText
import android.widget.EditText; //导入方法依赖的package包/类
private EditText createEditText(String hint, int Padding) {
EditText editText = (EditText) inflater.inflate(R.layout.item_edittext, null);
editText.setTag(viewTag++);
editText.setOnFocusChangeListener(focusChangeListener);
editText.setOnKeyListener(keyListener);
editText.setPadding(dip2px(EDIT_PADDING_TOP), Padding, dip2px(EDIT_PADDING_TOP), 0);
editText.setHint(hint);
return editText;
}
示例3: createEditText
import android.widget.EditText; //导入方法依赖的package包/类
/**
* 生成文本输入框
*/
public EditText createEditText(String hint, int paddingTop) {
EditText editText = (EditText) inflater.inflate(R.layout.hyper_edit_text, null);
editText.setOnKeyListener(keyListener);
editText.setTag(viewTagIndex++);
editText.setPadding(0, paddingTop, 0, paddingTop);
editText.setHint(hint);
editText.setOnFocusChangeListener(focusListener);
return editText;
}
示例4: onCreate
import android.widget.EditText; //导入方法依赖的package包/类
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_code_unlock);
Log.d("gaolei", "CodeUnlockActivity------------onCreate------------------");
// LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.dp2px(this, 50));
// layoutParams.setMargins(0, statusBarHeight, 0, 0);//4个参数按顺序分别是左上右下
// title_layout.setLayoutParams(layoutParams);
setStatusBar();
editText1 = (EditText) findViewById(R.id.editText1);
editText2 = (EditText) findViewById(R.id.editText2);
editText3 = (EditText) findViewById(R.id.editText3);
editText4 = (EditText) findViewById(R.id.editText4);
editText5 = (EditText) findViewById(R.id.editText5);
editText6 = (EditText) findViewById(R.id.editText6);
editText1.setTag(1);
editText2.setTag(2);
editText3.setTag(3);
editText4.setTag(4);
editText5.setTag(5);
editText6.setTag(6);
// 添加 内容change listener :输入焦点后移 + 密码验证
editText1.addTextChangedListener(new MyTextChangeWatcher(1));
editText2.addTextChangedListener(new MyTextChangeWatcher(2));
editText3.addTextChangedListener(new MyTextChangeWatcher(3));
editText4.addTextChangedListener(new MyTextChangeWatcher(4));
editText5.addTextChangedListener(new MyTextChangeWatcher(5));
editText6.addTextChangedListener(new MyTextChangeWatcher(6));
// del 监听,输入焦点前移
editText1.setOnKeyListener(keyListener);
editText2.setOnKeyListener(keyListener);
editText3.setOnKeyListener(keyListener);
editText4.setOnKeyListener(keyListener);
editText5.setOnKeyListener(keyListener);
editText6.setOnKeyListener(keyListener);
new Utils(this).showIMM();
// ShowKeyboard(editText1);
}
示例5: initViews
import android.widget.EditText; //导入方法依赖的package包/类
private void initViews() {
btnFrom = (Button) findViewById(R.id.from);
btnFrom.setOnClickListener(this);
btnTo = (Button) findViewById(R.id.to);
btnTo.setOnClickListener(this);
btnTrainNum = (Button) findViewById(R.id.trainNum); // 车次
btnTrainNum.setOnClickListener(this);
etDate = (EditText)findViewById(R.id.date);
btnDate = (Button) findViewById(R.id.btnDate); // 选择乘车日期
btnDate.setOnClickListener(this);
btnOK = (Button) findViewById(R.id.ok);
btnOK.setOnClickListener(this);
etTravelName = (EditText) findViewById(R.id.travelName);
etTime = (EditText) findViewById(R.id.time);
btnFrom.setText(setSP.getLastFromStationKey());
btnTo.setText(setSP.getLastToStationKey());
// 取得当前日期
Calendar c = Calendar.getInstance(Locale.getDefault());
c.setTimeInMillis(System.currentTimeMillis());
intYear = c.get(Calendar.YEAR);
intMonth = c.get(Calendar.MONTH);
intDay = c.get(Calendar.DAY_OF_MONTH);
String strDate = TimeUtil.getDFormat().format(c.getTime());
etDate.setText(strDate + " " + TimeUtil.getWeek(c.getTime()));
etDate.setTag(strDate);
if (this.getIntent().getStringExtra(TRAIN_NUM) != null){
strTrainNum = this.getIntent().getStringExtra(TRAIN_NUM);
btnFrom.setText(this.getIntent().getStringExtra(START_STATION));
btnTo.setText(this.getIntent().getStringExtra(END_STATION));
intDataSource = this.getIntent().getIntExtra(DATA_SOURCE, DATA_FROM_OFFINE_DB);
if (intDataSource == DATA_FROM_OFFINE_DB){
SimpleDialogFragment
.createBuilder(
AddInfoAty.this,
getSupportFragmentManager())
.setCancelable(false)
.setRequestCode(REQUET_SET_TRAVEL_BRIEF_OF_DATA_FROM_OFFLINE_DB)
.setTitle("提示")
.setMessage("检测到您采用离线数据快速添加数据,为保证数据准确性请您手动进行车次选择"+SF.TIP)
.setPositiveButtonText("确定")
.show();
}
String strStartTime = getIntent().getStringExtra(EXTRA_START_TIME);
if (!TextUtils.isEmpty(strStartTime)){
try {
Date date1 = TimeUtil.getDFormat().parse(strStartTime);
strStartTime = TimeUtil.getDFormat().format(date1);
etDate.setText(strStartTime + " " + TimeUtil.getWeek(strStartTime));
etDate.setTag(strStartTime);
} catch (ParseException e) {
e.printStackTrace();
}
}
getTrains();
}
}
示例6: 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);
}