List of usage examples for android.widget TextView setTypeface
public void setTypeface(@Nullable Typeface tf)
From source file:br.com.projeto.icebeer.MainFragment.java
private void updateTemperatura() { if (--temperatura < -5) { temperatura = 5.0;/* w w w . j a v a2 s . c o m*/ } Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "fonts/digital-7.ttf"); TextView tx = (TextView) getActivity().findViewById(R.id.txtTemperatura); tx.setText(String.valueOf(temperatura)); tx.setTextSize(80); tx.setTypeface(tf); TextView sw = (TextView) getActivity().findViewById(R.id.shadowTemperatura); sw.setText("88.8"); sw.setTextSize(80); sw.setTypeface(tf); }
From source file:com.casin.activity.HomeDrawerActivity.java
public void initHeaderLayout(String name, String balancePoints) { Typeface snapFont = Typeface.createFromAsset(getAssets(), "SNAP.TTF"); TextView headrTitleTextView = (TextView) findViewById(R.id.headerTitle); headrTitleTextView.setTypeface(snapFont); headrTitleTextView.setText(name);// w w w .j a v a2 s . c o m TextView scoreTitleTextView = (TextView) findViewById(R.id.score); scoreTitleTextView.setText(balancePoints); ImageView leftMenuBarImageView = (ImageView) findViewById(R.id.leftMenuBar); leftMenuBarImageView.setVisibility(View.VISIBLE); leftMenuBarImageView.setOnClickListener(leftMenuBarClickListener); }
From source file:com.spoiledmilk.ibikecph.favorites.FavoritesAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View view = inflater.inflate(getListRowLayout(), parent, false); TextView tv = (TextView) view.findViewById(R.id.textFavoriteName); String name = getItem(position).getName(); if (name.length() > 19) name = name.substring(0, 19) + "..."; tv.setText(name);//from ww w . j a va 2s . c om tv.setTypeface(IbikeApplication.getNormalFont()); tv.setTextColor(getTextColor()); ImageButton btnEdit = (ImageButton) view.findViewById(R.id.btnEdit); final FavoritesData fd = getItem(position); tv.setPadding(getPadding(fd), 0, 0, 0); btnEdit.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { fragment.onEditFavorite(fd); } }); final ImageView imgIcon = ((ImageView) view.findViewById(R.id.icon)); if (!isEditMode) { imgIcon.setImageResource(getIconResourceId(getItem(position))); btnEdit.setVisibility(View.GONE); } else { imgIcon.setImageResource(R.drawable.fav_reorder); btnEdit.setVisibility(View.VISIBLE); } return view; }
From source file:com.zzisoo.toylibrary.adapter.ToyListAdapter.java
@Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { // Create a new view. View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.toy_item_view, viewGroup, false); //setItemSize(v); TextView tvLoading = (TextView) (v.findViewById(R.id.tvLoading)); tvLoading.setTypeface(Typefaces.get(v.getContext(), "Satisfy-Regular.ttf")); return new ViewHolder(v); }
From source file:com.ibm.mil.readyapps.physio.fragments.PainManagementFragment.java
private void setupView(View view) { // set custom fonts TextView painQuestion = (TextView) view.findViewById(R.id.pain_question); painQuestion.setTypeface(AndroidUtils.robotoRegular(view.getContext())); TextView painDescription = (TextView) view.findViewById(R.id.pain_description); painDescription.setTypeface(AndroidUtils.robotoBold(view.getContext())); mEnterPainDescription = (EditText) view.findViewById(R.id.enter_pain_description); mEnterPainDescription.setTypeface(AndroidUtils.robotoRegular(view.getContext())); Button submitButton = (Button) view.findViewById(R.id.pain_submit_button); submitButton.setTypeface(AndroidUtils.robotoRegular(view.getContext())); final TextView painCircleNumber = (TextView) view.findViewById(R.id.pain_circle_number); painCircleNumber.setTypeface(AndroidUtils.robotoBold(view.getContext())); // initialize pain picker int minScaleValue = 0; int maxScaleValue = 10; TextView minLabel = (TextView) view.findViewById(R.id.min_label); minLabel.setTypeface(AndroidUtils.robotoThin(view.getContext())); TextView maxLabel = (TextView) view.findViewById(R.id.max_label); maxLabel.setTypeface(AndroidUtils.robotoThin(view.getContext())); TextView minValue = (TextView) view.findViewById(R.id.min_value); minValue.setTypeface(AndroidUtils.robotoBold(view.getContext())); minValue.setText(Integer.toString(minScaleValue)); TextView maxValue = (TextView) view.findViewById(R.id.max_value); maxValue.setTypeface(AndroidUtils.robotoBold(view.getContext())); maxValue.setText(Integer.toString(maxScaleValue)); mPainPicker = (WheelHorizontalView) view.findViewById(R.id.pain_picker); NumericWheelAdapter painAdapter = new NumericWheelAdapter(view.getContext(), minScaleValue, maxScaleValue); painAdapter.setItemResource(R.layout.pain_picker_text); painAdapter.setItemTextResource(R.id.pain_text); painAdapter.setTextTypeface(AndroidUtils.robotoRegular(view.getContext())); mPainPicker.setViewAdapter(painAdapter); mPainPicker.setVisibleItems(maxScaleValue - minScaleValue); mPainPicker.setItemsDimmedAlpha(255); int defaultScore = (maxScaleValue - minScaleValue) / 2; mPainPicker.setCurrentItem(defaultScore); painCircleNumber.setText(Integer.toString(mPainPicker.getCurrentItem())); // update pain circle number with the current centered value mPainPicker.addChangingListener(new OnWheelChangedListener() { @Override//from ww w . jav a 2 s . c o m public void onChanged(AbstractWheel wheel, int oldValue, int newValue) { painCircleNumber.setText(Integer.toString(newValue)); } }); submitButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final PhysioAlertDialog alertDialog = new PhysioAlertDialog(getActivity()); String message; if (isFormLayout) { message = getResources().getString(R.string.form_confirm); } else { message = getResources().getString(R.string.pain_confirm); } alertDialog.setPrimaryText(message); alertDialog.hideSecondaryText(true); if (!isFormLayout) { ColorDrawable color = new ColorDrawable(getResources().getColor(R.color.ready_red)); alertDialog.setButtonDrawable(color); } alertDialog.setPositiveClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Realm realm = Realm.getInstance(getActivity()); realm.beginTransaction(); PainReport report = realm.createObject(PainReport.class); report.setDate(new Date()); report.setPainAmount(mPainPicker.getCurrentItem()); report.setDescription(mEnterPainDescription.getText().toString()); realm.commitTransaction(); // force refresh in ProgressFragment to show new pain report data ProgressFragment.clearData(); final PhysioDialog dialog = new PhysioDialog(getActivity()); String message; if (isFormLayout) { message = getResources().getString(R.string.form_confirmed); } else { message = getResources().getString(R.string.pain_confirmed); dialog.getIcon().setImageDrawable(getResources().getDrawable(R.drawable.checkmark_red)); } dialog.getPrimaryMessage().setText(message); dialog.getSecondaryMessage().setVisibility(View.GONE); dialog.getButton().setVisibility(View.GONE); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { showLandingScreen(); } }); dialog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showLandingScreen(); dialog.cancel(); } }); dialog.show(); alertDialog.dismiss(); } }); alertDialog.setNegativeClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); } }); alertDialog.show(); } }); }
From source file:com.acrylicgoat.houstonbicyclemuseum.view.SlidingTabLayout.java
protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); }/*from w ww . j a v a 2 s . c o m*/ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { textView.setAllCaps(true); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:com.calgen.udacity.lego.ui.ArticleListActivity.java
private void setToolbarTitleTypeFace() { for (int i = 0; i < toolbar.getChildCount(); i++) { View view = toolbar.getChildAt(i); if (view instanceof TextView) { TextView textView = (TextView) view; Typeface pacifico = Typeface.createFromAsset(getAssets(), "fonts/Pacifico-Regular.ttf"); textView.setTypeface(pacifico); return; }/*from w w w. jav a2 s . com*/ } }
From source file:co.ldln.android.ObjectReadFragment.java
@Override public void onReadSchemaResult(Schema schema) { mSchema = schema;/*from ww w .j a va 2 s. co m*/ HashMap<String, String> keyValueMap = mSyncableObject.getKeyValueMap(); for (SchemaField schemaField : mSchema.getFields(mActivity)) { String label = schemaField.getLabel(); String value = keyValueMap.get(label); String type = schemaField.getType(); // Create a linear layout to hold the field LinearLayout ll = new LinearLayout(mActivity); LayoutParams llParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); ll.setLayoutParams(llParams); ll.setOrientation(LinearLayout.HORIZONTAL); // TODO: different UI for different field types // Default to TextView TextView labelTv = new TextView(mActivity); LayoutParams labelTvParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); labelTv.setLayoutParams(labelTvParams); labelTv.setText(label); labelTv.setPadding(0, 0, 20, 0); labelTv.setTypeface(Typeface.DEFAULT_BOLD); ll.addView(labelTv); TextView valueTv = new TextView(mActivity); LayoutParams valueTvParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); valueTv.setLayoutParams(valueTvParams); valueTv.setText(value); ll.addView(valueTv); mFormHolder.addView(ll); } }
From source file:com.bruno.distribuciones.android.SlidingTabLayout.java
protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); textView.setAllCaps(true);// ww w.j a v a 2s. c om int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:com.android.design.material.widgets.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}.//from w ww . j a v a 2 s .c o m */ protected TextView createDefaultTabView(Context context) { final TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTabTextViewSize); textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); final TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); textView.setAllCaps(true); final int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }