本文整理汇总了Java中android.widget.EditText.setTypeface方法的典型用法代码示例。如果您正苦于以下问题:Java EditText.setTypeface方法的具体用法?Java EditText.setTypeface怎么用?Java EditText.setTypeface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.EditText
的用法示例。
在下文中一共展示了EditText.setTypeface方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeViewComponents
import android.widget.EditText; //导入方法依赖的package包/类
private void initializeViewComponents() {
logInGoogleBtn = (Button) findViewById(R.id.log_in_google_btn);
logInDefaultBtn = (Button) findViewById(R.id.log_in_default_btn);
registerBtn = (TextView) findViewById(R.id.register_btn);
forgotPasswordBtn = (TextView) findViewById(R.id.forgot_password_btn);
regulations = (TextView) findViewById(R.id.regulations_btn);
emailText = (EditText) findViewById(R.id.email_login_text);
emailText.setSelected(false);
updateRememberedEmail();
passwordText = (EditText) findViewById(R.id.password_login_text);
passwordText.setTypeface(Typeface.DEFAULT);
passwordText.setTransformationMethod(new PasswordTransformationMethod());
passwordText.setSelected(false);
}
示例2: onCreate
import android.widget.EditText; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration);
registerRegulationsBtn = (TextView) findViewById(R.id.register_regulations_btn);
registerRegulationsBtn.setOnClickListener(new RegulationsOnClickListener());
registerNewUserBtn = (Button) findViewById(R.id.register_new_user_btn);
registerNewUserBtn.setOnClickListener(new RegisterNewUserOnClickListener());
passwordEditText = (EditText) findViewById(R.id.register_password_text);
passwordEditText.setTypeface(Typeface.DEFAULT);
passwordEditText.setTransformationMethod(new PasswordTransformationMethod());
repeatPasswordEditText = (EditText) findViewById(R.id.register_password_repeat_text);
repeatPasswordEditText.setTypeface(Typeface.DEFAULT);
repeatPasswordEditText.setTransformationMethod(new PasswordTransformationMethod());
}
示例3: onCreateDialog
import android.widget.EditText; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mBuilder = new AlertDialog.Builder(getActivity());
if (getArguments() != null)
mSelectedId = getArguments().getLongArray("PLAYLIST_IDS");
View view = getActivity().getLayoutInflater().inflate(R.layout.create_playlist, null);
mEditText = (EditText) view.findViewById(R.id.edit_text_playlist);
mEditText.addTextChangedListener(mTextWatcher);
mEditText.setTextColor(ContextCompat.getColor(getActivity().getApplicationContext(), R.color.black));
mEditText.setTypeface(TypefaceHelper.getTypeface(getActivity().getApplicationContext(), TypefaceHelper.FUTURA_BOOK));
mEditText.setHint(R.string.new_playlist_name);
mBuilder.setView(view);
mBuilder.setTitle(R.string.create_playlist);
mBuilder.setPositiveButton(R.string.save, (dialog, which) -> savePlaylist());
mBuilder.setNegativeButton(R.string.cancel, (dialog, which) -> dismiss());
return mBuilder.create();
}
示例4: onCreate
import android.widget.EditText; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manual_input);
Toolbar appBar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(appBar);
Util.setupAppBar(appBar, this);
Typeface typeFace= Typeface.createFromAsset(getAssets(), "fonts/ro.ttf");
docNumber = (EditText) findViewById(R.id.doc_num);
docNumber.setTypeface(typeFace);
TextView docNumTitle = (TextView) findViewById(R.id.doc_num_title);
TextView dobTitle = (TextView) findViewById(R.id.dob_title);
TextView expDateTitle = (TextView) findViewById(R.id.exp_date_title);
docNumTitle.setTypeface(typeFace);
dobTitle.setTypeface(typeFace);
expDateTitle.setTypeface(typeFace);
Button submitBut = (Button) findViewById(R.id.submit_button);
submitBut.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(verifyInput()) {
Intent returnIntent = new Intent();
returnIntent.putExtra(DocumentData.identifier, getData());
setResult(Activity.RESULT_OK, returnIntent);
finish();
}
}
});
setupDOBSpinners();
setupExpirySpinners();
// When docData was previously filled in, update text fields
if(getIntent().hasExtra(DocumentData.identifier)) {
putData(getIntent().getExtras());
}
}
示例5: onCreateView
import android.widget.EditText; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, inflater, container, savedInstanceState);
View top = inflater.inflate(R.layout.fragment_book_preface, container, false);
contentView = (EditText) top.findViewById(R.id.fragment_book_preface_content);
Activity activity = getActivity();
if (activity != null && AppPreferences.isFontMonospaced(getContext())) {
contentView.setTypeface(Typeface.MONOSPACE);
}
// Open keyboard
if (activity != null) {
ActivityUtils.openSoftKeyboard(activity, contentView);
}
/* Parse arguments - set content. */
if (getArguments() == null) {
throw new IllegalArgumentException(BookPrefaceFragment.class.getSimpleName() + " has no arguments passed");
}
if (!getArguments().containsKey(ARG_BOOK_ID)) {
throw new IllegalArgumentException(BookPrefaceFragment.class.getSimpleName() + " has no book id passed");
}
if (!getArguments().containsKey(ARG_BOOK_PREFACE)) {
throw new IllegalArgumentException(BookPrefaceFragment.class.getSimpleName() + " has no book preface passed");
}
bookId = getArguments().getLong(ARG_BOOK_ID);
book = BooksClient.get(getActivity(), bookId);
contentView.setText(getArguments().getString(ARG_BOOK_PREFACE));
return top;
}
示例6: setUpViews
import android.widget.EditText; //导入方法依赖的package包/类
private void setUpViews() {
edtTitulo = (EditText) findViewById(R.id.titulo);
edtCorpo = (EditText) findViewById(R.id.corpo);
edtTitulo.setTypeface(pfBeausans);
edtCorpo.setTypeface(pfBeausans);
edtTitulo.setHint(R.string.tituloAnotacao);
edtCorpo.setHint(R.string.corpoAnotacao);
}
示例7: onCreate
import android.widget.EditText; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reg);
//xmlファイルとの紐づけ
btn_issue = (Button)findViewById(R.id.button_issue);
hidebtn_reset = (Button)findViewById(R.id.hide_button);
btn_share = (ImageButton)findViewById(R.id.button_share);
btn_findmode = (ImageButton)findViewById(R.id.button_findmode);
id_box = (EditText)findViewById(R.id.text_id);
text_idshow = (TextView)findViewById(R.id.id_show);
btnmsg_sh = (TextView)findViewById(R.id.text_share);
btnmsg_se = (TextView)findViewById(R.id.text_search);
error_message = (TextView)findViewById(R.id.error_msg);
app = (MeePaApp) this.getApplication();
app.loadUserInfo();
user_name = app.getSelfUserName();
myID = app.getSelfUserId();
id_box.setText(user_name, TextView.BufferType.NORMAL);
text_idshow.setText(myID);
//フォント設定
btn_issue.setTypeface( Typeface.createFromAsset( getAssets(), "FLOPDesignFont.ttf" ), Typeface.NORMAL );
id_box.setTypeface( Typeface.createFromAsset( getAssets(), "FLOPDesignFont.ttf" ), Typeface.NORMAL );
text_idshow.setTypeface( Typeface.createFromAsset( getAssets(), "FLOPDesignFont.ttf" ), Typeface.NORMAL );
hidebtn_reset.setTypeface( Typeface.createFromAsset( getAssets(), "FLOPDesignFont.ttf" ), Typeface.NORMAL );
btnmsg_sh.setTypeface( Typeface.createFromAsset( getAssets(), "FLOPDesignFont.ttf" ), Typeface.NORMAL );
btnmsg_se.setTypeface( Typeface.createFromAsset( getAssets(), "FLOPDesignFont.ttf" ), Typeface.NORMAL );
error_message.setTypeface( Typeface.createFromAsset( getAssets(), "FLOPDesignFont.ttf" ), Typeface.NORMAL );
hidebtn_reset.setAllCaps(false);
hidebtn_reset.setText("Your Name");
error_message.setGravity(Gravity.CENTER);
//各ボタンのClickListenerの宣言
btn_issue.setOnClickListener(issListener);
hidebtn_reset.setOnClickListener(hideListener);
btn_share.setOnClickListener(shaListener);
btn_findmode.setOnClickListener(findListener);
// ボタンの幅,高さが決定してから幅=高さに揃える
// ViewTreeObserverを利用
// 参考 : http://tech.admax.ninja/2014/09/17/how-to-get-the-height-and-width-of-the-view/
// https://anz-note.tumblr.com/post/96096731156/androidで動的に縦幅あるいは横幅に合わせて正方形のviewを作成したい
final ViewTreeObserver observer = btn_share.getViewTreeObserver();
observer.addOnGlobalLayoutListener(
new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// ボタンの幅=高さにする
// Log.d("btn", btn_share.getWidth() + ", " + btn_share.getHeight());
ViewGroup.LayoutParams params = btn_share.getLayoutParams();
// 短辺の長さに長辺を揃える
if (btn_share.getWidth() < btn_share.getHeight())
params.height = btn_share.getWidth();
else params.width = btn_share.getHeight();
// 位置調整用に幅・高さの差をとる
int diff = btn_share.getHeight() - btn_share.getWidth();
btn_share.setLayoutParams( params );
btn_findmode.setLayoutParams( params );
// 表示位置を調整
if ( diff > 0 ) { // 高さを幅に合わせた(縦幅が縮んだ)場合Y座標を調整
btn_share.setTranslationY( diff/2 );
btn_findmode.setTranslationY( diff/2 );
} else { // 幅に高さを合わせた(横幅が縮んだ)場合X座標を調整
btn_share.setTranslationX( -diff/2 );
btn_findmode.setTranslationX( -diff/2 );
}
removeOnGlobalLayoutListener(btn_share.getViewTreeObserver(), this);
}
});
}
示例8: buildSavePresetDialog
import android.widget.EditText; //导入方法依赖的package包/类
/**
* Builds the "Save Preset" dialog. Does not call the show() method, so you
* should do this manually when calling this method.
*
* @return A fully built AlertDialog reference.
*/
private AlertDialog buildSavePresetDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
View dialogView = getLayoutInflater().inflate(R.layout.add_new_equalizer_preset_dialog_layout, null);
final EditText newPresetNameField = (EditText) dialogView.findViewById(R.id.new_preset_name_text_field);
newPresetNameField.setTypeface(TypefaceHelper.getTypeface(mContext, TypefaceHelper.FUTURA_BOOK));
newPresetNameField.setPaintFlags(newPresetNameField.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
//Set the dialog title.
builder.setTitle(R.string.save_preset);
builder.setView(dialogView);
builder.setNegativeButton(R.string.cancel, (dialog, arg1) -> dialog.dismiss());
builder.setPositiveButton(R.string.done, (dialog, which) -> {
//Get the preset name from the text field.
String presetName = newPresetNameField.getText().toString();
//Add the preset and it's values to the DB.
mApp.getDBAccessHelper().addNewEQPreset(presetName,
fiftyHertzLevel,
oneThirtyHertzLevel,
threeTwentyHertzLevel,
eightHundredHertzLevel,
twoKilohertzLevel,
fiveKilohertzLevel,
twelvePointFiveKilohertzLevel,
(short) mVirtualizerSeekArc.getProgress(),
(short) mBassBoostSeekArc.getProgress(),
(short) mReverbSpinner.getSelectedItemPosition());
Toast.makeText(mContext, R.string.preset_saved, Toast.LENGTH_SHORT).show();
dialog.dismiss();
});
return builder.create();
}
示例9: setUpViews
import android.widget.EditText; //导入方法依赖的package包/类
private void setUpViews(View view) {
txtBimestre1 = (TextView) view.findViewById(R.id.textbimestre1);
txtBimestre2 = (TextView) view.findViewById(R.id.textbimestre2);
txtProvaFinal = (TextView) view.findViewById(R.id.textprovaf);
btCalcular = (Button) view.findViewById(R.id.btcalcular);
edtBimestre1 = (EditText) view.findViewById(R.id.bimestre1);
edtBimestre2 = (EditText) view.findViewById(R.id.bimestre2);
edtProvaFinal = (EditText) view.findViewById(R.id.provafinal);
situacaoStatus = (TextView) view.findViewById(R.id.situaresult);
txtMensagem = (TextView) view.findViewById(R.id.textprecisa);
txtResultado = (TextView) view.findViewById(R.id.resultadotext);
txtMedia = (TextView) view.findViewById(R.id.media);
txtNota = (TextView) view.findViewById(R.id.textNota);
resultShow = (LinearLayout) view.findViewById(R.id.resultShow);
//set font in views
txtBimestre1.setTypeface(pfBeausans);
txtBimestre2.setTypeface(pfBeausans);
txtProvaFinal.setTypeface(pfBeausans);
btCalcular.setTypeface(pfBeausans);
edtBimestre1.setTypeface(pfBeausans);
edtBimestre2.setTypeface(pfBeausans);
edtProvaFinal.setTypeface(pfBeausans);
situacaoStatus.setTypeface(pfBeausans);
txtMensagem.setTypeface(pfBeausans);
txtResultado.setTypeface(pfBeausans);
txtMedia.setTypeface(pfBeausans);
txtNota.setTypeface(pfBeausans);
if (zeroAcem)
txtNota.setText(getString(R.string.nota100));
else
txtNota.setText(getString(R.string.nota10));
//set onClick Buttons
btCalcular.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
calculaNotas(v);
}
});
}
示例10: setUpViews
import android.widget.EditText; //导入方法依赖的package包/类
private void setUpViews(View view) {
txtBimestre1 = (TextView) view.findViewById(R.id.textbimestre1);
txtBimestre2 = (TextView) view.findViewById(R.id.textbimestre2);
txtBimestre3 = (TextView) view.findViewById(R.id.textbimestre3);
txtBimestre4 = (TextView) view.findViewById(R.id.textbimestre4);
txtProvaFinal = (TextView) view.findViewById(R.id.textprovaf);
btCalcular = (Button) view.findViewById(R.id.btcalcular);
edtBimestre1 = (EditText) view.findViewById(R.id.bimestre1);
edtBimestre2 = (EditText) view.findViewById(R.id.bimestre2);
edtBimestre3 = (EditText) view.findViewById(R.id.bimestre3);
edtBimestre4 = (EditText) view.findViewById(R.id.bimestre4);
edtProvaFinal = (EditText) view.findViewById(R.id.provafinal);
situacaoStatus = (TextView) view.findViewById(R.id.situaresult);
txtMensagem = (TextView) view.findViewById(R.id.textprecisa);
txtResultado = (TextView) view.findViewById(R.id.resultadotext);
txtMedia = (TextView) view.findViewById(R.id.media);
txtNota = (TextView) view.findViewById(R.id.textNota);
resultShow = (LinearLayout) view.findViewById(R.id.resultShow);
//set font in views
txtBimestre1.setTypeface(pfBeausans);
txtBimestre2.setTypeface(pfBeausans);
txtBimestre3.setTypeface(pfBeausans);
txtBimestre4.setTypeface(pfBeausans);
txtProvaFinal.setTypeface(pfBeausans);
btCalcular.setTypeface(pfBeausans);
edtBimestre1.setTypeface(pfBeausans);
edtBimestre2.setTypeface(pfBeausans);
edtBimestre3.setTypeface(pfBeausans);
edtBimestre4.setTypeface(pfBeausans);
edtProvaFinal.setTypeface(pfBeausans);
situacaoStatus.setTypeface(pfBeausans);
txtMensagem.setTypeface(pfBeausans);
txtResultado.setTypeface(pfBeausans);
txtMedia.setTypeface(pfBeausans);
txtNota.setTypeface(pfBeausans);
if (zeroAcem)
txtNota.setText(getString(R.string.nota100));
else
txtNota.setText(getString(R.string.nota10));
//set onClick Buttons
btCalcular.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
calculaNotas(v);
}
});
}
示例11: setUpViews
import android.widget.EditText; //导入方法依赖的package包/类
private void setUpViews() {
txtTituloDisc = (TextView) findViewById(R.id.textTitulo);
txtBimestre1 = (TextView) findViewById(R.id.textbimestre1);
txtBimestre2 = (TextView) findViewById(R.id.textbimestre2);
txtBimestre3 = (TextView) findViewById(R.id.textbimestre3);
txtBimestre4 = (TextView) findViewById(R.id.textbimestre4);
txtProvaFinal = (TextView) findViewById(R.id.textprovaf);
edtTituloDisciplina = (EditText) findViewById(R.id.tituloDisciplina);
edtBimestre1 = (EditText) findViewById(R.id.bimestre1);
edtBimestre2 = (EditText) findViewById(R.id.bimestre2);
edtBimestre3 = (EditText) findViewById(R.id.bimestre3);
edtBimestre4 = (EditText) findViewById(R.id.bimestre4);
edtProvaFinal = (EditText) findViewById(R.id.provafinal);
situacaoStatus = (TextView) findViewById(R.id.situaresult);
txtMensagem = (TextView) findViewById(R.id.textprecisa);
txtResultado = (TextView) findViewById(R.id.resultadotext);
txtMedia = (TextView) findViewById(R.id.media);
txtNota = (TextView) findViewById(R.id.textNota);
txtResultError = (TextView) findViewById(R.id.txtResultError);
resultShow = (LinearLayout) findViewById(R.id.resultShow);
resultError = (LinearLayout) findViewById(R.id.resultError);
result = (TextView) findViewById(R.id.result);
med = (TextView) findViewById(R.id.mediatext);
situ = (TextView) findViewById(R.id.situacao);
//set font in views
txtTituloDisc.setTypeface(pfBeausans);
txtBimestre1.setTypeface(pfBeausans);
txtBimestre2.setTypeface(pfBeausans);
txtBimestre3.setTypeface(pfBeausans);
txtBimestre4.setTypeface(pfBeausans);
txtProvaFinal.setTypeface(pfBeausans);
edtTituloDisciplina.setTypeface(pfBeausans);
edtBimestre1.setTypeface(pfBeausans);
edtBimestre2.setTypeface(pfBeausans);
edtBimestre3.setTypeface(pfBeausans);
edtBimestre4.setTypeface(pfBeausans);
edtProvaFinal.setTypeface(pfBeausans);
situacaoStatus.setTypeface(pfBeausans);
txtMensagem.setTypeface(pfBeausans);
txtResultado.setTypeface(pfBeausans);
txtMedia.setTypeface(pfBeausans);
txtNota.setTypeface(pfBeausans);
txtResultError.setTypeface(pfBeausans);
result.setTypeface(pfBeausans);
med.setTypeface(pfBeausans);
situ.setTypeface(pfBeausans);
if (zeroAcem)
txtNota.setText(getString(R.string.nota100));
else
txtNota.setText(getString(R.string.nota10));
}
示例12: onCreate
import android.widget.EditText; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
mAppName = getString(R.string.app_name);
initConfig();
Intent intent = getIntent();
if(Intent.ACTION_VIEW.equals(getIntent().getAction()) ||
Intent.ACTION_EDIT.equals(getIntent().getAction()) ||
Intent.ACTION_GET_CONTENT.equals(getIntent().getAction())
)
{
Uri uri = intent.getData();
if(uri != null)
{
filepath = uri.getPath();
}
}
else
{
filepath = intent.getStringExtra("FILEPATH");
selStart = intent.getIntExtra("SELSTART", 0);
selStop = intent.getIntExtra("SELSTOP", 0);
}
aFile = new File(filepath);
setContentView(R.layout.editbox);
edit = (EditText) findViewById(R.id.editbox);
edit.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
edit.setTypeface(mTypeface);
registerForContextMenu(edit);
if(aFile.isDirectory())
{
setTitleBarText("(" + getString(R.string.hint_newfile) + ")");
messageDigest = getMessageDigest();
}
else
{
this.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
setTitleBarText(aFile.getName());
progressDlg = ProgressDialog.show(this, null, "Now Loading...", true, false);
new FileReadThread().start();
}
if(showBottomBarFlag)
{
addBottomBar();
}
//initListener();
initListener1();
}