本文整理汇总了Java中android.widget.TextView.setInputType方法的典型用法代码示例。如果您正苦于以下问题:Java TextView.setInputType方法的具体用法?Java TextView.setInputType怎么用?Java TextView.setInputType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TextView
的用法示例。
在下文中一共展示了TextView.setInputType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) {
if (!(view instanceof TextView))
return;
TextView textView = (TextView) view;
String[] types = value.split("[|]");
int inputType = 0;
for (String type : types) {
if (mInputTypes.containsKey(type)) {
inputType |= mInputTypes.get(type);
}
}
if (inputType != 0)
textView.setInputType(inputType);
}
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:16,代码来源:ConvertLayoutInflater.java
示例2: onFinishInflate
import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onFinishInflate() {
super.onFinishInflate();
final Context context = getContext();
textView = (TextView) getChildAt(0);
textView.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
textView.setHintTextColor(lessSignificantColor);
textView.setHorizontalFadingEdgeEnabled(true);
textView.setSingleLine();
setValidateAmount(textView instanceof EditText);
textView.addTextChangedListener(textViewListener);
textView.setOnFocusChangeListener(textViewListener);
contextButton = new View(context) {
@Override
protected void onMeasure(final int wMeasureSpec, final int hMeasureSpec) {
setMeasuredDimension(textView.getCompoundPaddingRight(), textView.getMeasuredHeight());
}
};
final LayoutParams chooseViewParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
chooseViewParams.gravity = Gravity.RIGHT;
contextButton.setLayoutParams(chooseViewParams);
this.addView(contextButton);
updateAppearance();
}
示例3: initView
import android.widget.TextView; //导入方法依赖的package包/类
private void initView(){
View view = mInflater.inflate(R.layout.widet_num_add_sub,this,true);
mEtxtNum = (TextView) view.findViewById(R.id.etxt_num);
mEtxtNum.setInputType(InputType.TYPE_NULL);
mEtxtNum.setKeyListener(null);
mBtnAdd = (Button) view.findViewById(R.id.btn_add);
mBtnSub = (Button) view.findViewById(R.id.btn_sub);
mBtnAdd.setOnClickListener(this);
mBtnSub.setOnClickListener(this);
}
示例4: initView
import android.widget.TextView; //导入方法依赖的package包/类
private void initView() {
View view = mInflater.inflate(R.layout.widet_num_add_sub, this, true);
mEtxtNum = (TextView) view.findViewById(R.id.etxt_num);
mEtxtNum.setInputType(InputType.TYPE_NULL);
mEtxtNum.setKeyListener(null);
mBtnAdd = (Button) view.findViewById(R.id.btn_add);
mBtnSub = (Button) view.findViewById(R.id.btn_sub);
mBtnAdd.setOnClickListener(this);
mBtnSub.setOnClickListener(this);
}
示例5: setInputType
import android.widget.TextView; //导入方法依赖的package包/类
public SuperRecyclerHolder setInputType(@IdRes int viewId, int type) {
TextView textView = retrieveView(viewId);
textView.setInputType(type);
return this;
}