List of usage examples for android.widget TextView setTextColor
@android.view.RemotableViewMethod public void setTextColor(ColorStateList colors)
From source file:br.com.carlosrafaelgn.fplay.ActivityBrowserRadio.java
@Override public View getDropDownView(int position, View convertView, ViewGroup parent) { TextView txt = (TextView) convertView; if (txt == null) { txt = new TextView(getApplication()); txt.setPadding(UI._DLGdppad, UI._DLGsppad, UI._DLGdppad, UI._DLGsppad); txt.setTypeface(UI.defaultTypeface); txt.setTextSize(TypedValue.COMPLEX_UNIT_PX, UI._DLGsp); txt.setTextColor(defaultTextColors); }/*from w w w . j av a 2 s. c om*/ txt.setText(getGenreString(position)); return txt; }
From source file:com.sutromedia.android.core.PhotoActivity.java
public void onSetupView(View view, int viewId) { final IPhoto photo = getCurrentPhoto(); if (photo != null) { int backgroundId = (viewId == R.layout.image_view_inside) ? R.drawable.attrib_inside : R.drawable.attrib_outside; Drawable background = getResources().getDrawable(backgroundId); background.setAlpha(155);/*from ww w .j ava2s . c om*/ view.findViewById(R.image.licenseGroup).setBackgroundDrawable(background); setVisibility(view, R.image.caption, !mInSlideShow && !isSubsetOnEntry()); TextView caption = (TextView) view.findViewById(R.image.caption); String entryName = photo.getEntryName(); if (entryName != null) { entryName = entryName.replace(' ', '\u00A0'); entryName += "\u00A0\u00A0\u25B6"; } caption.setText(entryName); caption.setSingleLine(true); caption.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { onReceiveEntry(new NavigationDetailWeb(photo.getEntryId())); } }); setVisibility(view, R.image.licenseGroup, !mInSlideShow); Integer[] icons = PhotoLicence.getIcons(photo); setImageView(view, R.image.license1, 0, icons); setImageView(view, R.image.license2, 1, icons); TextView owner = (TextView) view.findViewById(R.image.owner); if (icons.length > 0) { owner.setText(photo.getAuthor()); } else { view.findViewById(R.image.licenseGroup).setVisibility(View.GONE); } String url = photo.getUrl(); View licenceGroup = view.findViewById(R.image.licenseGroup); if (url != null && url.length() > 0) { owner.setTextColor(Color.rgb(0x19, 0x49, 0x90)); owner.setTypeface(null, Typeface.BOLD); licenceGroup.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { onReceiveEntry(new NavigationWeb(photo.getUrl())); } }); } else { owner.setTypeface(null, Typeface.NORMAL); owner.setTextColor(Color.WHITE); licenceGroup.setOnClickListener(null); } setupTouchOnPlayButton(); setVisibility(R.image.play_slideshow, !mInSlideShow && mShowSlideShowControls); setVisibility(R.image.loading, mMissingPhoto); setVisibility(R.image.wait, mMissingPhoto && isOnline()); String missingTextTemplate = getString( mMissingPhoto && isOnline() ? R.string.missing_photo : R.string.missing_not_online); String missingText = String.format(missingTextTemplate, mCurrentImage + 1, getImageCountInSet()); setText(R.image.missing, missingText); } }
From source file:com.jgraves.achievementunlocked.AchievementsList_Fragment.java
private void addAchievementToList(Long id, String name, int points) { Log.i(ExploraApp.TAG, "Adding achievement image request of id " + id + " with height, " + imageViewHeight); FrameLayout fl = new FrameLayout(getActivity()); touchMap.put(fl, id);/*from www . j a v a2 s. co m*/ fl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Long id = touchMap.get(v); Log.i(ExploraApp.TAG, "TOUCHED " + id); Intent intent = new Intent(getActivity(), Activity_AchievementInfo.class); intent.putExtra("achievement_id", Long.toString(id)); startActivity(intent); } }); TextView tv_name = new TextView(getActivity()); TextView tv_points = new TextView(getActivity()); ImageView iv = new ImageView(getActivity()); fl.setMinimumHeight(imageViewHeight); fl.setMinimumWidth(ExploraApp.screenWidth); robotoTypeface = Typeface.createFromAsset(getActivity().getAssets(), "Roboto-Thin.ttf"); tv_name.setText(name); tv_name.setTextSize(15f); tv_points.setTextSize(15f); tv_name.setTypeface(robotoTypeface); tv_points.setTypeface(robotoTypeface); tv_points.setText(Integer.toString(points)); tv_points.setGravity(Gravity.RIGHT); tv_points.setTextColor(Color.WHITE); tv_name.setTextColor(Color.WHITE); iv.setMinimumHeight(imageViewHeight); iv.setMinimumWidth(ExploraApp.screenWidth); fl.addView(iv); fl.addView(tv_name); fl.addView(tv_points); ll_images_container.addView(fl); sv_images.bringChildToFront(mQuickReturnView); DefaultImageListener listener = new DefaultImageListener(iv); ImageRequest imageRequest = new ImageRequest( ExploraApp.url_main + "/achievement/" + id + "/photo?y=" + imageViewHeight + "&x=" + ExploraApp.screenWidth, listener, ExploraApp.screenWidth, imageViewHeight, Bitmap.Config.ARGB_8888, listener); ExploraApp.mRequestQueue.add(imageRequest); }
From source file:com.app.blockydemo.content.bricks.SetVariableBrick.java
@Override public View getViewWithAlpha(int alphaValue) { if (view != null) { TextView textSetVariable = (TextView) view.findViewById(R.id.brick_set_variable_label); TextView textTo = (TextView) view.findViewById(R.id.brick_set_variable_to_textview); TextView editVariable = (TextView) view.findViewById(R.id.brick_set_variable_edit_text); Spinner variablebrickSpinner = (Spinner) view.findViewById(R.id.set_variable_spinner); ColorStateList color = textSetVariable.getTextColors().withAlpha(alphaValue); variablebrickSpinner.getBackground().setAlpha(alphaValue); if (adapterView != null) { ((TextView) adapterView.getChildAt(0)).setTextColor(color); }/*from w ww . j a v a 2 s .c o m*/ textSetVariable.setTextColor(textSetVariable.getTextColors().withAlpha(alphaValue)); textTo.setTextColor(textTo.getTextColors().withAlpha(alphaValue)); editVariable.setTextColor(editVariable.getTextColors().withAlpha(alphaValue)); editVariable.getBackground().setAlpha(alphaValue); this.alphaValue = (alphaValue); } return view; }
From source file:com.example.drugsformarinemammals.Dose_Information.java
public TextView createInformationTextView() { TextView information_textview = new TextView(this); information_textview.setTextColor(Color.BLACK); information_textview.setTextSize(16); information_textview.setTypeface(Typeface.SANS_SERIF); return information_textview; }
From source file:cn.qbcbyb.library.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; if (i == currentItem) { tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabSelectedTextSize); } else { tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); }//from w w w.j av a 2 s. com 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.app.blockydemo.content.bricks.ChangeVariableBrick.java
@Override public View getViewWithAlpha(int alphaValue) { if (view != null) { View layout = view.findViewById(R.id.brick_change_variable_layout); Drawable background = layout.getBackground(); background.setAlpha(alphaValue); TextView textSetVariable = (TextView) view.findViewById(R.id.brick_change_variable_label); TextView textTo = (TextView) view.findViewById(R.id.brick_change_variable_by); TextView editVariable = (TextView) view.findViewById(R.id.brick_change_variable_edit_text); Spinner variablebrickSpinner = (Spinner) view.findViewById(R.id.change_variable_spinner); ColorStateList color = textSetVariable.getTextColors().withAlpha(alphaValue); variablebrickSpinner.getBackground().setAlpha(alphaValue); if (adapterView != null) { ((TextView) adapterView.getChildAt(0)).setTextColor(color); }//w w w. j a v a2 s .c o m textSetVariable.setTextColor(textSetVariable.getTextColors().withAlpha(alphaValue)); textTo.setTextColor(textTo.getTextColors().withAlpha(alphaValue)); editVariable.setTextColor(editVariable.getTextColors().withAlpha(alphaValue)); editVariable.getBackground().setAlpha(alphaValue); this.alphaValue = (alphaValue); } return view; }
From source file:com.astuetz.PagerSlidingTabStripCustom.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, textSize);//TODO // tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); // tab.setTextColor(tabTextColor); tab.setTextColor(textColor);//TODO // 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 ww w . j a v a 2 s . c om*/ } //TODO ?pageTitle? if (mCurrentPosition == i) { tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectTextSize); tab.setTextColor(selectTextColor); } } } }
From source file:ca.ualberta.cmput301w14t08.geochan.adapters.ThreadViewAdapter.java
/** * Sets all the required views for a comment reply. Comment text, * creator, time.//from ww w . j a v a 2 s . c o m * * @param convertView View that contains the comment. * @param reply the Comment object that we are setting fields for. * */ private void setCommentFields(View convertView, Comment reply) { if (reply.hasImage()) { ImageButton thumbnail = (ImageButton) convertView.findViewById(R.id.thread_view_comment_thumbnail); thumbnail.setVisibility(View.VISIBLE); thumbnail.setFocusable(false); thumbnail.setImageBitmap(reply.getImageThumb()); } else { ImageButton thumbnail = (ImageButton) convertView.findViewById(R.id.thread_view_comment_thumbnail); thumbnail.setVisibility(View.GONE); thumbnail.setFocusable(false); } // Comment body TextView replyBody = (TextView) convertView.findViewById(R.id.thread_view_comment_commentBody); replyBody.setText(reply.getTextPost()); // Comment creator TextView replyBy = (TextView) convertView.findViewById(R.id.thread_view_comment_commentBy); replyBy.setText(reply.getUser() + "#" + reply.getHash() + " "); String username = PreferencesManager.getInstance().getUser(); if (HashHelper.getHash(reply.getUser()).equals(reply.getHash())) { replyBy.setBackgroundResource(R.drawable.username_background_rect); replyBy.setTextColor(Color.WHITE); } // Comment timestamp TextView replyTime = (TextView) convertView.findViewById(R.id.thread_view_comment_commentDate); replyTime.setText(reply.getCommentDateString()); }
From source file:com.alimuzaffar.ramadanalarm.widget.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 ww w . j a va 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); if (mTextColor > 0) { textView.setTextColor(getContext().getResources().getColor(mTextColor)); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }