本文整理了Java中android.widget.TextView.setTransformationMethod()
方法的一些代码示例,展示了TextView.setTransformationMethod()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.setTransformationMethod()
方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:setTransformationMethod
暂无
代码示例来源:origin: robolectric/robolectric
@Test
public void shouldAllowSettingATransformationMethod() {
textView.setTransformationMethod(PasswordTransformationMethod.getInstance());
assertThat(textView.getTransformationMethod()).isInstanceOf(PasswordTransformationMethod.class);
}
代码示例来源:origin: wangdan/AisenWeiBo
if (Build.VERSION.SDK_INT <= 14) {
mAmPmTextView.setTransformationMethod(new TransformationMethod() {
代码示例来源:origin: stackoverflow.com
TextView textView = (TextView) findViewById(R.id.textview);
textView.setTransformationMethod(null);
...
textView.setText(ss);
代码示例来源:origin: Jungerr/GridPasswordView
/**
* Set the enabled state of this view.
*/
@Override
public void setPasswordVisibility(boolean visible) {
for (TextView textView : mViewArr) {
textView.setTransformationMethod(visible ? null : mTransformationMethod);
if (textView instanceof EditText) {
EditText et = (EditText) textView;
et.setSelection(et.getText().length());
}
}
}
代码示例来源:origin: Jungerr/GridPasswordView
private void setCustomAttr(TextView view) {
if (mTextColor != null)
view.setTextColor(mTextColor);
view.setTextSize(mTextSize);
int inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD;
switch (mPasswordType) {
case 1:
inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD;
break;
case 2:
inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
break;
case 3:
inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD;
break;
}
view.setInputType(inputType);
view.setTransformationMethod(mTransformationMethod);
}
代码示例来源:origin: Airsaid/InputCodeLayout
private void setShowMode(TextView textView){
if (mShowMode == NORMAL)
textView.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
else
textView.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
代码示例来源:origin: stackoverflow.com
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
UserAccountDataHolder holder = null;
if (row == null) {
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
row = inflater.inflate(layoutResourceId, parent, false);
}
UserAccountData userAccountData = data[position];
TextView tvTitle = (TextView) row.findViewById(R.id.txtTitle);
if(userAccountData.type.equals("pass")){
tvTitle.setTransformationMethod(new PasswordTransformationMethod());
}
if(userAccountData.type.equals("notPass")){
tvTitle .setTransformationMethod(null);
}
}
代码示例来源:origin: stackoverflow.com
@SuppressLint("NewApi")
public static void setAllCaps(TextView textView, boolean allCaps) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH){
textView.setAllCaps(allCaps);
}else{
textView.setTransformationMethod(allCaps ? AllCapsTransformationMethodCompat.getInstance() : null);
}
}
代码示例来源:origin: kingargyle/adt-leanback-support
public static void setSingleLineAllCaps(TextView text) {
text.setTransformationMethod(new SingleLineAllCapsTransform(text.getContext()));
}
代码示例来源:origin: netmackan/ATimeTracker
public TimeView(Context context, TimeRange t) {
super(context);
setOrientation(LinearLayout.HORIZONTAL);
setPadding(5, 10, 5, 10);
dateRange = new TextView(context);
dateRange.setTextSize(fontSize);
addView(dateRange, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 1f));
total = new TextView(context);
total.setTextSize(fontSize);
total.setGravity(Gravity.RIGHT);
total.setTransformationMethod(SingleLineTransformationMethod.getInstance());
addView(total, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 0.0f));
setTimeRange(t);
}
代码示例来源:origin: netmackan/ATimeTracker
public ActivityView(Context context, Activity t) {
super(context);
setOrientation(LinearLayout.HORIZONTAL);
setPadding(5, 10, 5, 10);
name = new TextView(context);
name.setTextSize(fontSize);
name.setText(t.getName());
addView(name, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 1f));
checkMark = new ImageView(context);
checkMark.setImageResource(R.drawable.ic_check_mark_dark);
checkMark.setVisibility(View.INVISIBLE);
addView(checkMark, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 0f));
total = new TextView(context);
total.setTextSize(fontSize);
total.setGravity(Gravity.RIGHT);
total.setTransformationMethod(SingleLineTransformationMethod.getInstance());
total.setText(formatTotal(decimalFormat, t.getTotal(), 0));
addView(total, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT, 0f));
setGravity(Gravity.TOP);
markupSelectedActivity(t);
}
代码示例来源:origin: Kunzisoft/Android-SwitchDateTimePicker
mAmPmTextView.setTransformationMethod(new TransformationMethod() {
内容来源于网络,如有侵权,请联系作者删除!