本文整理汇总了Java中com.beardedhen.androidbootstrap.BootstrapEditText.setText方法的典型用法代码示例。如果您正苦于以下问题:Java BootstrapEditText.setText方法的具体用法?Java BootstrapEditText.setText怎么用?Java BootstrapEditText.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.beardedhen.androidbootstrap.BootstrapEditText
的用法示例。
在下文中一共展示了BootstrapEditText.setText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showEditTextDialog
import com.beardedhen.androidbootstrap.BootstrapEditText; //导入方法依赖的package包/类
public static void showEditTextDialog(Context mContext, String title, String initialText, final IFuncPtr functionToBeRun) {
LayoutInflater inflater = (LayoutInflater)mContext.getSystemService (Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.dialog_with_text, null);
// custom dialog
final Dialog dialog = new AlertDialog.Builder(mContext)
.setTitle(title)
.setView(v)
.create();
BootstrapButton okButton = (BootstrapButton) v.findViewById(R.id.okbutton);
final BootstrapEditText insertedText = (BootstrapEditText) v.findViewById(R.id.addedText);
insertedText.setText(initialText);
okButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
functionToBeRun.execute(insertedText.getText().toString());
dialog.dismiss();
}
});
dialog.show();
}
示例2: onCreateView
import com.beardedhen.androidbootstrap.BootstrapEditText; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
act = getActivity();
rootView = inflater.inflate(R.layout.fragment_login, container, false);
setHasOptionsMenu(true);
final BootstrapEditText email = (BootstrapEditText) rootView.findViewById(R.id.email);
final BootstrapEditText password = (BootstrapEditText) rootView.findViewById(R.id.password);
final BootstrapButton btnLogin = (BootstrapButton) rootView.findViewById(R.id.btnLogin);
CheckBox checkBox = (CheckBox) rootView.findViewById(R.id.showPass);
InputFilter filter = new InputFilter() {
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
for (int i = start; i < end; i++) {
if (Character.isSpaceChar(source.charAt(i))) {
return "";
}
}
return null;
}
};
email.setFilters(new InputFilter[]{filter});
password.setFilters(new InputFilter[]{filter});
if(!act.getSharedPreferences("EroadPrefs", 0).getString("user_name", "").equals("")){
email.setText(act.getSharedPreferences("EroadPrefs", 0).getString("user_email", ""));
}
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (!isChecked) {
password.setTransformationMethod(PasswordTransformationMethod.getInstance());
} else {
password.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
}
}
});
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String string_email = email.getText().toString();
String string_password = password.getText().toString();
if (!string_password.trim().equals("")) {
new CheckIfUserExists(string_email, encryptPassword(string_password)).execute();
}else {
Toast.makeText(act, "The password can not be empty", Toast.LENGTH_SHORT).show();
}
}
});
return rootView;
}