List of usage examples for android.widget TextView setTextColor
@android.view.RemotableViewMethod public void setTextColor(ColorStateList colors)
From source file:com.collcloud.frame.viewpager.PagerSlidingTabStrip.java
public void updateTabStyles(int curPosition) { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof RelativeLayout) { RelativeLayout rL = (RelativeLayout) v; TextView tab = (TextView) rL.getChildAt(0); tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); if (curPosition == i) { tab.setTextColor(pstsTextHighLightColor); } else { tab.setTextColor(tabTextColor); }/*from w w w. j av a2 s . com*/ // 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:edu.cens.loci.ui.widget.GenericEditorView.java
private void updateWifiList(TableLayout table, LociWifiFingerprint wifi) { ArrayList<WifiViewListItem> items = new ArrayList<WifiViewListItem>(); HashMap<String, APInfoMapItem> apMap = wifi.getAps(); Set<String> keys = apMap.keySet(); Iterator<String> iter = keys.iterator(); while (iter.hasNext()) { String bssid = iter.next(); APInfoMapItem ap = apMap.get(bssid); items.add(new WifiViewListItem(bssid, ap.ssid, ap.rss, ap.count, ap.rssBuckets)); }/*from w ww .ja v a 2s. co m*/ Collections.sort(items); table.setColumnCollapsed(0, false); table.setColumnCollapsed(1, true); table.setColumnShrinkable(0, true); for (int i = 0; i < mAddedRows.size(); i++) { table.removeView(mAddedRows.get(i)); } mAddedRows.clear(); int totalCount = wifi.getScanCount(); Context context = getContext(); for (WifiViewListItem item : items) { TableRow row = new TableRow(context); TextView ssidView = new TextView(context); ssidView.setText(item.ssid); //ssidView.setText("very very very veryvery very very very very very"); ssidView.setPadding(2, 2, 2, 2); ssidView.setTextColor(0xffffffff); TextView bssidView = new TextView(context); bssidView.setText(item.bssid); bssidView.setPadding(2, 2, 2, 2); bssidView.setTextColor(0xffffffff); TextView cntView = new TextView(context); cntView.setText("" + (item.count * 100) / totalCount); cntView.setPadding(2, 2, 2, 2); cntView.setGravity(Gravity.CENTER); cntView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); TextView rssView = new TextView(context); rssView.setText("" + item.rss); rssView.setPadding(2, 2, 6, 2); rssView.setGravity(Gravity.CENTER); rssView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); row.addView(ssidView, new TableRow.LayoutParams(0)); row.addView(bssidView, new TableRow.LayoutParams(1)); row.addView(cntView, new TableRow.LayoutParams(2)); row.addView(rssView, new TableRow.LayoutParams(3)); //Log.d(TAG, item.ssid); for (int i = 0; i < item.rssBuckets.length; i++) { TextView box = new TextView(context); box.setText(" "); box.setGravity(Gravity.RIGHT); box.setPadding(2, 2, 2, 2); box.setHeight(15); box.setGravity(Gravity.CENTER_VERTICAL); float colorVal = 256 * ((float) item.rssBuckets[i] / (float) wifi.getScanCount()); //Log.d(TAG, "colorVal=" + (int) colorVal + ", " + item.histogram[i]); int colorValInt = ((int) colorVal) - 1; if (colorValInt < 0) colorValInt = 0; box.setBackgroundColor(0xff000000 + colorValInt);//+ 0x000000ff * (item.histogram[i]/totScan)); box.setTextColor(0xffffffff); row.addView(box, new TableRow.LayoutParams(4 + i)); } row.setGravity(Gravity.CENTER); table.addView(row, new TableLayout.LayoutParams()); table.setColumnStretchable(3, true); mAddedRows.add(row); } }
From source file:br.com.carlosrafaelgn.fplay.ActivityBrowserRadio.java
@Override public View getView(int position, View convertView, ViewGroup parent) { TextView txt = (TextView) convertView; if (txt == null) { txt = new TextView(getApplication()); txt.setPadding(UI._8dp, UI._4dp, UI._8dp, UI._4dp); txt.setTypeface(UI.defaultTypeface); txt.setTextSize(TypedValue.COMPLEX_UNIT_PX, UI._DLGsp); txt.setTextColor(defaultTextColors); }//from w w w . ja v a2 s . c o m txt.setText(getGenreString(position)); return txt; }
From source file:br.org.funcate.dynamicforms.views.GPictureView.java
/** * @param fragmentDetail the fragment detail to use. * @param attrs attributes. * @param requestCode the code for starting the activity with result. * @param parentView parent/*from w ww .jav a2s. c om*/ * @param label label * @param pictures the value are the ids and binary data of the images. * @param constraintDescription constraints */ public GPictureView(final FragmentDetail fragmentDetail, AttributeSet attrs, final int requestCode, LinearLayout parentView, String label, Map<String, Map<String, String>> pictures, String constraintDescription) { super(fragmentDetail.getActivity(), attrs); thumbnailWidth = fragmentDetail.getActivity().getResources().getInteger(R.integer.thumbnail_width); thumbnailHeight = fragmentDetail.getActivity().getResources().getInteger(R.integer.thumbnail_height); mFragmentDetail = fragmentDetail; _pictures = pictures; PICTURE_VIEW_RESULT = requestCode; final FragmentActivity activity = fragmentDetail.getActivity(); LinearLayout textLayout = new LinearLayout(activity); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); layoutParams.setMargins(10, 10, 10, 10); textLayout.setPadding(10, 5, 10, 5); textLayout.setLayoutParams(layoutParams); textLayout.setOrientation(LinearLayout.VERTICAL); parentView.addView(textLayout); TextView textView = new TextView(activity); textView.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); textView.setPadding(2, 2, 2, 2); String t = label.replace(UNDERSCORE, " ").replace(COLON, " ") + " " + constraintDescription; textView.setText(t); textView.setTextColor(activity.getResources().getColor(R.color.formcolor)); textLayout.addView(textView); final Button button = new Button(activity); button.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); button.setPadding(15, 5, 15, 5); button.setText(R.string.take_picture); textLayout.addView(button); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent cameraIntent = new Intent(activity, CameraActivity.class); cameraIntent.putExtra(FormUtilities.MAIN_APP_WORKING_DIRECTORY, fragmentDetail.getWorkingDirectory()); fragmentDetail.startActivityForResult(cameraIntent, requestCode); } }); ScrollView scrollView = new ScrollView(activity); ScrollView.LayoutParams scrollLayoutParams = new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); scrollView.setLayoutParams(scrollLayoutParams); scrollView.setHorizontalScrollBarEnabled(true); scrollView.setOverScrollMode(HorizontalScrollView.OVER_SCROLL_ALWAYS); parentView.addView(scrollView); imageLayout = new LinearLayout(activity); LinearLayout.LayoutParams imageLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); imageLayout.setLayoutParams(imageLayoutParams); imageLayout.setPadding(15, 5, 15, 5); imageLayout.setOrientation(LinearLayout.HORIZONTAL); imageLayout.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); scrollView.addView(imageLayout); updateValueForm(); try { refresh(activity); } catch (Exception e) { //GPLog.error(this, null, e); e.printStackTrace(); Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_LONG).show(); } }
From source file:com.ashish.routofy.PagerSlidingTabStrip.java
private void notSelected(View tab) { if (tab != null) { TextView title = (TextView) tab.findViewById(R.id.psts_tab_title); if (title != null) { title.setTypeface(tabTypeface, tabTypefaceStyle); title.setTextColor(tabTextColor); }// w w w . j a v a 2 s .c om } }
From source file:com.pursuer.reader.easyrss.VerticalSingleItemView.java
@SuppressLint({ "NewApi", "SimpleDateFormat" }) public VerticalSingleItemView(final DataMgr dataMgr, final Context context, final String uid, final View menu, final VerticalItemViewCtrl itemViewCtrl) { this.dataMgr = dataMgr; this.context = context; this.item = dataMgr.getItemByUid(uid, ITEM_PROJECTION); this.fontSize = new SettingFontSize(dataMgr).getData(); this.theme = new SettingTheme(dataMgr).getData(); this.showTop = false; this.showBottom = false; this.menu = menu; this.itemViewCtrl = itemViewCtrl; this.imageClickTime = 0; final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.view = inflater.inflate(R.layout.single_item_view, null); // Disable hardware acceleration on Android 3.0-4.1 devices. if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR1 && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { view.setLayerType(View.LAYER_TYPE_SOFTWARE, null); }/*ww w . j av a 2 s . co m*/ lastItemView = view.findViewById(R.id.LastItemView); nextItemView = view.findViewById(R.id.NextItemView); itemScrollView = (OverScrollView) view.findViewById(R.id.ItemScrollView); itemScrollView.setTopScrollView(lastItemView); itemScrollView.setBottomScrollView(nextItemView); itemScrollView.setOnScrollChangeListener(this); itemScrollView.setOnTouchListener(this); final View btnShowOriginal = view.findViewById(R.id.BtnShowOriginal); btnShowOriginal.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(final View view, final MotionEvent event) { boolean ret = false; final TextView txt = (TextView) view.findViewById(R.id.BtnText); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: txt.setTextColor(0xFF787878); ret = true; break; case MotionEvent.ACTION_MOVE: ret = true; break; case MotionEvent.ACTION_CANCEL: txt.setTextColor(0xBB787878); ret = false; break; case MotionEvent.ACTION_UP: txt.setTextColor(0xBB787878); final SettingBrowserChoice setting = new SettingBrowserChoice(dataMgr); if (setting.getData() == SettingBrowserChoice.BROWSER_CHOICE_EXTERNAL) { final Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse(item.getHref())); context.startActivity(intent); } else if (VerticalSingleItemView.this.listener != null) { VerticalSingleItemView.this.listener.showWebsitePage(item.getUid(), false); } break; default: } return ret; } }); final View btnShowMobilized = view.findViewById(R.id.BtnShowMobilized); btnShowMobilized.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(final View view, final MotionEvent event) { boolean ret = false; final TextView txt = (TextView) view.findViewById(R.id.BtnText); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: txt.setTextColor(0xFF787878); ret = true; break; case MotionEvent.ACTION_MOVE: ret = true; break; case MotionEvent.ACTION_CANCEL: txt.setTextColor(0xBB787878); ret = false; break; case MotionEvent.ACTION_UP: txt.setTextColor(0xBB787878); if (VerticalSingleItemView.this.listener != null) { VerticalSingleItemView.this.listener.showWebsitePage(item.getUid(), true); } ret = true; break; default: } return ret; } }); { final ListItemItem lastItem = itemViewCtrl.getLastItem(item.getUid()); final TextView txt = (TextView) lastItemView.findViewById(R.id.LastItemTitle); txt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize); if (lastItem == null) { lastUid = null; menu.findViewById(R.id.BtnPrevious).setEnabled(false); final ImageView img = (ImageView) lastItemView.findViewById(R.id.LastItemArrow); img.setImageResource(R.drawable.no_more_circle); txt.setText(R.string.TxtNoPreviousItem); } else { lastUid = lastItem.getId(); final View btnLast = menu.findViewById(R.id.BtnPrevious); btnLast.setEnabled(true); btnLast.setOnClickListener(new OnClickListener() { @Override public void onClick(final View view) { if (listener != null) { listener.showLastItem(); } } }); txt.setText(lastItem.getTitle()); } } { final ListItemItem nextItem = itemViewCtrl.getNextItem(item.getUid()); final TextView txt = (TextView) nextItemView.findViewById(R.id.NextItemTitle); txt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize); if (nextItem == null) { nextUid = null; menu.findViewById(R.id.BtnNext).setEnabled(false); final ImageView img = (ImageView) nextItemView.findViewById(R.id.NextItemArrow); img.setImageResource(R.drawable.no_more_circle); txt.setText(R.string.TxtNoNextItem); } else { nextUid = nextItem.getId(); final View btnNext = menu.findViewById(R.id.BtnNext); btnNext.setEnabled(true); btnNext.setOnClickListener(new OnClickListener() { @Override public void onClick(final View view) { if (listener != null) { listener.showNextItem(); } } }); txt.setText(nextItem.getTitle()); } } final TextView title = (TextView) view.findViewById(R.id.ItemTitle); title.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize * 4 / 3); title.setText(item.getTitle()); final TextView info = (TextView) view.findViewById(R.id.ItemInfo); info.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize * 4 / 5); final StringBuilder infoText = new StringBuilder(); final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); sdf.setTimeZone(TimeZone.getDefault()); infoText.append(sdf.format(Utils.timestampToDate(item.getTimestamp()))); if (item.getAuthor() != null && item.getAuthor().length() > 0) { infoText.append(" | By "); infoText.append(item.getAuthor()); } if (item.getSourceTitle() != null && item.getSourceTitle().length() > 0) { infoText.append(" ("); infoText.append(item.getSourceTitle()); infoText.append(")"); } info.setText(infoText); webView = (WebView) view.findViewById(R.id.webView); webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); webView.setBackgroundColor(context.getResources() .getColor(theme == SettingTheme.THEME_NORMAL ? R.color.NormalBackground : R.color.DarkBackground)); webView.setFocusable(false); webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(final WebView view, final String url) { if (VerticalSingleItemView.this.imageClickTime > System.currentTimeMillis() - 1000) { return true; } final Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse(url)); context.startActivity(intent); return true; } }); webView.setWebChromeClient(new WebChromeClient() { @Override public boolean onJsAlert(final WebView view, final String url, final String message, final JsResult result) { if (VerticalSingleItemView.this.listener != null) { if (message.endsWith(".erss")) { VerticalSingleItemView.this.listener .onImageViewRequired(item.getStoragePath() + "/" + message); } else { VerticalSingleItemView.this.listener.onImageViewRequired(message); } } VerticalSingleItemView.this.imageClickTime = System.currentTimeMillis(); result.cancel(); return true; } }); updateButtonStar(); updateButtonSharing(); updateButtonOpenLink(); if (!item.getState().isRead()) { dataMgr.markItemAsReadWithTransactionByUid(uid); NetworkMgr.getInstance().startImmediateItemStateSyncing(); } }
From source file:com.androidinspain.deskclock.DeskClock.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.desk_clock); mSnackbarAnchor = findViewById(R.id.content); // Configure the toolbar. final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/*ww w .j a v a 2 s . c o m*/ final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(false); } // Configure the menu item controllers add behavior to the toolbar. mOptionsMenuManager.addMenuItemController(new NightModeMenuItemController(this), new SettingsMenuItemController(this)); mOptionsMenuManager .addMenuItemController(MenuItemControllerFactory.getInstance().buildMenuItemControllers(this)); // Inflate the menu during creation to avoid a double layout pass. Otherwise, the menu // inflation occurs *after* the initial draw and a second layout pass adds in the menu. onCreateOptionsMenu(toolbar.getMenu()); // Create the tabs that make up the user interface. mTabLayout = (TabLayout) findViewById(R.id.tabs); final int tabCount = UiDataModel.getUiDataModel().getTabCount(); final boolean showTabLabel = getResources().getBoolean(R.bool.showTabLabel); final boolean showTabHorizontally = getResources().getBoolean(R.bool.showTabHorizontally); for (int i = 0; i < tabCount; i++) { final UiDataModel.Tab tabModel = UiDataModel.getUiDataModel().getTab(i); final @StringRes int labelResId = tabModel.getLabelResId(); final TabLayout.Tab tab = mTabLayout.newTab().setTag(tabModel).setIcon(tabModel.getIconResId()) .setContentDescription(labelResId); if (showTabLabel) { tab.setText(labelResId); tab.setCustomView(R.layout.tab_item); @SuppressWarnings("ConstantConditions") final TextView text = (TextView) tab.getCustomView().findViewById(android.R.id.text1); text.setTextColor(mTabLayout.getTabTextColors()); // Bind the icon to the TextView. final Drawable icon = tab.getIcon(); if (showTabHorizontally) { // Remove the icon so it doesn't affect the minimum TabLayout height. tab.setIcon(null); text.setCompoundDrawablesRelativeWithIntrinsicBounds(icon, null, null, null); } else { text.setCompoundDrawablesRelativeWithIntrinsicBounds(null, icon, null, null); } } mTabLayout.addTab(tab); } // Configure the buttons shared by the tabs. mFab = (ImageView) findViewById(R.id.fab); mLeftButton = (Button) findViewById(R.id.left_button); mRightButton = (Button) findViewById(R.id.right_button); mFab.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { getSelectedDeskClockFragment().onFabClick(mFab); } }); mLeftButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { getSelectedDeskClockFragment().onLeftButtonClick(mLeftButton); } }); mRightButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { getSelectedDeskClockFragment().onRightButtonClick(mRightButton); } }); final long duration = UiDataModel.getUiDataModel().getShortAnimationDuration(); final ValueAnimator hideFabAnimation = getScaleAnimator(mFab, 1f, 0f); final ValueAnimator showFabAnimation = getScaleAnimator(mFab, 0f, 1f); final ValueAnimator leftHideAnimation = getScaleAnimator(mLeftButton, 1f, 0f); final ValueAnimator rightHideAnimation = getScaleAnimator(mRightButton, 1f, 0f); final ValueAnimator leftShowAnimation = getScaleAnimator(mLeftButton, 0f, 1f); final ValueAnimator rightShowAnimation = getScaleAnimator(mRightButton, 0f, 1f); hideFabAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { getSelectedDeskClockFragment().onUpdateFab(mFab); } }); leftHideAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { getSelectedDeskClockFragment().onUpdateFabButtons(mLeftButton, mRightButton); } }); // Build the reusable animations that hide and show the fab and left/right buttons. // These may be used independently or be chained together. mHideAnimation.setDuration(duration).play(hideFabAnimation).with(leftHideAnimation) .with(rightHideAnimation); mShowAnimation.setDuration(duration).play(showFabAnimation).with(leftShowAnimation) .with(rightShowAnimation); // Build the reusable animation that hides and shows only the fab. mUpdateFabOnlyAnimation.setDuration(duration).play(showFabAnimation).after(hideFabAnimation); // Build the reusable animation that hides and shows only the buttons. mUpdateButtonsOnlyAnimation.setDuration(duration).play(leftShowAnimation).with(rightShowAnimation) .after(leftHideAnimation).after(rightHideAnimation); // Customize the view pager. mFragmentTabPagerAdapter = new FragmentTabPagerAdapter(this); mFragmentTabPager = (ViewPager) findViewById(R.id.desk_clock_pager); // Keep all four tabs to minimize jank. mFragmentTabPager.setOffscreenPageLimit(3); // Set Accessibility Delegate to null so view pager doesn't intercept movements and // prevent the fab from being selected. mFragmentTabPager.setAccessibilityDelegate(null); // Mirror changes made to the selected page of the view pager into UiDataModel. mFragmentTabPager.addOnPageChangeListener(new PageChangeWatcher()); mFragmentTabPager.setAdapter(mFragmentTabPagerAdapter); // Mirror changes made to the selected tab into UiDataModel. mTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { UiDataModel.getUiDataModel().setSelectedTab((UiDataModel.Tab) tab.getTag()); } @Override public void onTabUnselected(TabLayout.Tab tab) { } @Override public void onTabReselected(TabLayout.Tab tab) { } }); // Honor changes to the selected tab from outside entities. UiDataModel.getUiDataModel().addTabListener(mTabChangeWatcher); }
From source file:br.com.laboratorio.hemope.View.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 w w. j a v a 2 s. c o m*/ */ 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); textView.setTextColor(Color.WHITE); int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:com.android.yijiang.kzx.widget.PagerSlidingTabStrip.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);//ww w . j a v a 2s. c om } else { v.setPadding(tabPadding, 12, tabPadding, 0); } if (v instanceof TextView) { TextView tab = (TextView) v; // tab.setTextSize(TypedValue.COMPLEX_UNIT_SP, tabTextSize); // tab.setTextSize(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) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:com.ashish.routofy.PagerSlidingTabStrip.java
private void selected(View tab) { if (tab != null) { TextView title = (TextView) tab.findViewById(R.id.psts_tab_title); if (title != null) { title.setTypeface(tabTypeface, tabTypefaceSelectedStyle); title.setTextColor(tabTextColorSelected); }//from w w w .ja v a 2s .co m } }