List of usage examples for android.widget TextView setTypeface
public void setTypeface(@Nullable Typeface tf, @Typeface.Style int style)
From source file:PagerSlidingTab.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setLayoutParams(defaultTabLayoutParams); v.setBackgroundResource(tabBackgroundResId); if (shouldExpand) { v.setPadding(0, 0, 0, 0);/*from w ww . ja v a2 s . c om*/ } else { v.setPadding(tabPadding, 0, tabPadding, 0); } if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(i == 0 ? getResources().getColor(R.color.indicator_color) : tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:com.astuetz.PagerSlidingTrilateralStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); //?item,,?? /*add by HJ begin ??*/ if (pager.getCurrentItem() == i) { // tab.setTextColor(tabSelectedTextColor); } else { //? tab.setTextColor(tabNormalTextColor); }// ww w . jav a2 s . c om /*add by HJ end ??*/ // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:com.baseutil.strip.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); if (tabResources != null) { tab.setCompoundDrawablesWithIntrinsicBounds(tabResources[i], 0, 0, 0); }//from ww w.jav a2s. c om // setAllCaps() is only available from API 14, so the upper case // is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:com.bowen.hannengclub.view.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor);// ? // ############ ?? ############## // ###### ############ if (i == pager.getCurrentItem()) { // tab.setTextColor(tabTextSelectedColor); } else { // tab.setTextColor(tabTextNormalColor); }// ww w . ja va2 s . co m // ########################### // setAllCaps() is only available from API 14, so the upper case // is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:cn.edu.qzu.face.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); // v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); // tab.setTextColor(tabTextColor); tab.setTextColor(tabTextColorStateList); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }/*from w w w.j a va2s . c o m*/ } } } }
From source file:com.QuarkLabs.BTCeClient.fragments.HomeFragment.java
/** * Refreshes funds table with fetched data * * @param response JSONObject with funds data *///from w w w .j a v a2 s . c o m private void refreshFunds(JSONObject response) { try { if (response == null) { Toast.makeText(getActivity(), getResources().getString(R.string.GeneralErrorText), Toast.LENGTH_LONG).show(); return; } String notificationText; if (response.getInt("success") == 1) { View.OnClickListener fillAmount = new View.OnClickListener() { @Override public void onClick(View v) { ScrollView scrollView = (ScrollView) getView(); if (scrollView != null) { EditText tradeAmount = (EditText) scrollView.findViewById(R.id.TradeAmount); tradeAmount.setText(((TextView) v).getText()); scrollView.smoothScrollTo(0, scrollView.findViewById(R.id.tradingSection).getBottom()); } } }; notificationText = getResources().getString(R.string.FundsInfoUpdatedtext); TableLayout fundsContainer = (TableLayout) getView().findViewById(R.id.FundsContainer); fundsContainer.removeAllViews(); JSONObject funds = response.getJSONObject("return").getJSONObject("funds"); JSONArray fundsNames = response.getJSONObject("return").getJSONObject("funds").names(); List<String> arrayList = new ArrayList<>(); for (int i = 0; i < fundsNames.length(); i++) { arrayList.add(fundsNames.getString(i)); } Collections.sort(arrayList); TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1); for (String anArrayList : arrayList) { TableRow row = new TableRow(getActivity()); TextView currency = new TextView(getActivity()); TextView amount = new TextView(getActivity()); currency.setText(anArrayList.toUpperCase(Locale.US)); amount.setText(funds.getString(anArrayList)); currency.setLayoutParams(layoutParams); currency.setTypeface(Typeface.DEFAULT, Typeface.BOLD); currency.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); currency.setGravity(Gravity.CENTER); amount.setLayoutParams(layoutParams); amount.setGravity(Gravity.CENTER); amount.setOnClickListener(fillAmount); row.addView(currency); row.addView(amount); fundsContainer.addView(row); } } else { notificationText = response.getString("error"); } mCallback.makeNotification(ConstantHolder.ACCOUNT_INFO_NOTIF_ID, notificationText); } catch (JSONException e) { e.printStackTrace(); } }
From source file:com.baseutil.strip.PagerSlidingTabStrip.java
private void updateTabTextColorStyles(int pos, int color, int unselectedcolor) { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); if (pos == i) { tab.setTextColor(color); } else { tab.setTextColor(unselectedcolor); }// ww w . j a v a 2 s . c o m if (tabResources != null) { tab.setCompoundDrawablesWithIntrinsicBounds(tabResources[i], 0, 0, 0); } // setAllCaps() is only available from API 14, so the upper case // is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:com.bwash.bwashcar.view.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); if (pager.getAdapter() instanceof IconTabProvider) { TextView tab = (TextView) v.findViewById(R.id.text); tab.setTextSize(TypedValue.COMPLEX_UNIT_DIP, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(((IconTabProvider) pager.getAdapter()).getPageTextColor(i)); tab.setCompoundDrawablesWithIntrinsicBounds( getResources().getDrawable(((IconTabProvider) pager.getAdapter()).getPageIconResId(i)), null, null, null);//ww w.j av a 2 s .c o m // tab.setBackgroundDrawable(getResources().getDrawable(((IconTabProvider)pager.getAdapter()).getPageIconResId(i))); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } else { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_DIP, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(0xffffffff); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:com.hm.library.resource.tabstrip.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { try { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper // case // is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ((TextView) tab).setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }/*from ww w .jav a 2s . c o m*/ } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectedTabTextSize); tab.getPaint().setFakeBoldText(true); } else { tab.getPaint().setFakeBoldText(false); } } catch (Exception e) { e.printStackTrace(); } } } }
From source file:brostore.maquillage.custom.PagerSlidingTabStrip.java
private void setTextViewStyle(View v) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); // TODO//from www .j a va 2 s .c o m //tab.setTextColor(tabTextColor); ColorStateList colorStateList = new ColorStateList(new int[][] { new int[] { android.R.attr.state_pressed }, //1 new int[] { android.R.attr.state_selected }, //2 new int[] {} //3 }, new int[] { Color.WHITE, //1 Color.WHITE, //2 getResources().getColor(R.color.tab_text_color_unselected) //3 }); tab.setTextColor(colorStateList); tab.setTextScaleX(tabTextScaleX); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } }