List of usage examples for android.widget TextView setTextColor
@android.view.RemotableViewMethod public void setTextColor(ColorStateList colors)
From source file:com.appybite.customer.RegisterActivity.java
private void updateHotelList() { //. Department List llHotelList.removeAllViews();/* w w w. ja v a 2 s.com*/ for (int i = 0; i < aryHotelList.size(); i++) { final HotelInfo value = aryHotelList.get(i); LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View item = null; if (DeviceUtil.isTabletByRes(this)) item = vi.inflate(R.layout.item_depart_tab, llHotelList, false); else item = vi.inflate(R.layout.item_depart, llHotelList, false); ImageView ivThumb = (ImageView) item.findViewById(R.id.ivThumb); if (value.license == "pro") { ImageLoader.getInstance().displayImage(value.hotel_logo, ivThumb, options, animateFirstListener); } else if (value.license == "demo") { ImageLoader.getInstance().displayImage(value.hotel_logo, ivThumb, options, animateFirstListener); } TextView tvTitle = (TextView) item.findViewById(R.id.tvTitle); tvTitle.setText(value.hotel_name); tvTitle.setSelected(true); if (i == 0) tvTitle.setTextColor(getResources().getColor(R.color.Goldenrod)); item.setTag(tvTitle); item.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { unselectHotels(); ((TextView) arg0.getTag()).setTextColor(getResources().getColor(R.color.Goldenrod)); hotel_id = value.hotel_id; hotel_license = value.license; } }); if (!PRJFUNC.DEFAULT_SCREEN) { PRJFUNC.mGrp.relayoutView(item, LayoutLib.LP_LinearLayout); PRJFUNC.mGrp.setTextViewFontScale(tvTitle); PRJFUNC.mGrp.repaddingView(tvTitle); PRJFUNC.mGrp.relayoutView(item.findViewById(R.id.ivShadowTop), LayoutLib.LP_RelativeLayout); PRJFUNC.mGrp.relayoutView(item.findViewById(R.id.ivShadowBottom), LayoutLib.LP_RelativeLayout); } llHotelList.addView(item); } }
From source file:de.madvertise.android.sdk.MadView.java
private void showTextBannerView() { MadUtil.logMessage(null, Log.DEBUG, "Add text banner"); TextView textView = new TextView(getContext()); textView.setGravity(Gravity.CENTER); textView.setText(currentAd.getText()); textView.setTextSize(textSize);/*from w w w .j a v a 2 s. com*/ textView.setTextColor(textColor); textView.setTypeface(Typeface.DEFAULT_BOLD); setBackgroundDrawable(textBannerBackground); removeAllViews(); addView(textView); }
From source file:com.apptentive.android.sdk.module.engagement.interaction.fragment.SurveyFragment.java
@Override public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (interaction == null) { getActivity().finish();/* w w w . ja v a 2 s .c om*/ } List<Question> questions = interaction.getQuestions(); answers = new LinkedHashMap<String, Object>(questions.size()); View v = inflater.inflate(R.layout.apptentive_survey, container, false); TextView description = (TextView) v.findViewById(R.id.description); description.setText(interaction.getDescription()); final Button send = (Button) v.findViewById(R.id.send); String sendText = interaction.getSubmitText(); if (!TextUtils.isEmpty(sendText)) { send.setText(sendText); } send.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Util.hideSoftKeyboard(getActivity(), view); boolean valid = validateAndUpdateState(); if (valid) { if (interaction.isShowSuccessMessage() && !TextUtils.isEmpty(interaction.getSuccessMessage())) { Toast toast = new Toast(getContext()); toast.setGravity(Gravity.FILL, 0, 0); toast.setDuration(Toast.LENGTH_SHORT); View toastView = inflater.inflate(R.layout.apptentive_survey_sent_toast, (LinearLayout) getView().findViewById(R.id.survey_sent_toast_root)); toast.setView(toastView); TextView actionTV = ((TextView) toastView.findViewById(R.id.survey_sent_action_text)); actionTV.setText(interaction.getSuccessMessage()); int actionColor = Util.getThemeColor(getContext(), R.attr.apptentiveSurveySentToastActionColor); if (actionColor != 0) { actionTV.setTextColor(actionColor); ImageView actionIcon = (ImageView) toastView.findViewById(R.id.survey_sent_action_icon); actionIcon.setColorFilter(actionColor); } toast.show(); } getActivity().finish(); EngagementModule.engageInternal(getActivity(), interaction, EVENT_SUBMIT); ApptentiveInternal.getInstance().getApptentiveTaskManager() .addPayload(new SurveyResponse(interaction, answers)); ApptentiveLog.d("Survey Submitted."); callListener(true); } else { Toast toast = new Toast(getContext()); toast.setGravity(Gravity.FILL_HORIZONTAL | Gravity.BOTTOM, 0, 0); toast.setDuration(Toast.LENGTH_SHORT); View toastView = inflater.inflate(R.layout.apptentive_survey_invalid_toast, (LinearLayout) getView().findViewById(R.id.survey_invalid_toast_root)); toast.setView(toastView); String validationText = interaction.getValidationError(); if (!TextUtils.isEmpty(validationText)) { ((TextView) toastView.findViewById(R.id.survey_invalid_toast_text)).setText(validationText); } toast.show(); } } }); questionsContainer = (LinearLayout) v.findViewById(R.id.questions); if (savedInstanceState == null) { questionsContainer.removeAllViews(); // Then render all the questions for (int i = 0; i < questions.size(); i++) { Question question = questions.get(i); BaseSurveyQuestionView surveyQuestionView; if (question.getType() == Question.QUESTION_TYPE_SINGLELINE) { surveyQuestionView = TextSurveyQuestionView.newInstance((SinglelineQuestion) question); } else if (question.getType() == Question.QUESTION_TYPE_MULTICHOICE) { surveyQuestionView = MultichoiceSurveyQuestionView.newInstance((MultichoiceQuestion) question); } else if (question.getType() == Question.QUESTION_TYPE_MULTISELECT) { surveyQuestionView = MultiselectSurveyQuestionView.newInstance((MultiselectQuestion) question); } else if (question.getType() == Question.QUESTION_TYPE_RANGE) { surveyQuestionView = RangeSurveyQuestionView.newInstance((RangeQuestion) question); } else { surveyQuestionView = null; } if (surveyQuestionView != null) { surveyQuestionView.setOnSurveyQuestionAnsweredListener(this); getRetainedChildFragmentManager().beginTransaction() .add(R.id.questions, surveyQuestionView, Integer.toString(i)).commit(); } } } else { List<Fragment> fragments = getRetainedChildFragmentManager().getFragments(); for (Fragment fragment : fragments) { BaseSurveyQuestionView questionFragment = (BaseSurveyQuestionView) fragment; questionFragment.setOnSurveyQuestionAnsweredListener(this); } } return v; }
From source file:com.android.biubiu.component.indicator.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); if (tabBackgroundResId != 0) { v.setBackgroundResource(tabBackgroundResId); }/*from ww w .j av a2s . c o m*/ if (v instanceof TextView) { 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) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } }*/ } } }
From source file:astuetz.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); // 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)); }//w ww . j a v a 2s . c o m } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } } }
From source file:app.hanks.com.conquer.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); // 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)); }// w w w . j a va 2 s . com } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } } }
From source file:com.applite.common.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); // 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 v a 2 s . c o m*/ } if (i == selectedPosition) { tab.setSelected(true); } else { tab.setSelected(false); } } } }
From source file:com.example.android.wearable.quiz.MainActivity.java
/** * Resets the current quiz when Reset Quiz is pressed. *//* w w w. ja va 2 s. com*/ public void resetQuiz(View view) { // Reset quiz status in phone layout. for (int i = 0; i < questionsContainer.getChildCount(); i++) { LinearLayout questionStatusElement = (LinearLayout) questionsContainer.getChildAt(i); TextView questionText = (TextView) questionStatusElement.findViewById(R.id.question); TextView questionStatus = (TextView) questionStatusElement.findViewById(R.id.status); questionText.setTextColor(Color.WHITE); questionStatus.setText(R.string.question_unanswered); } // Reset data items and notifications on wearable. if (mGoogleApiClient.isConnected()) { Wearable.DataApi.getDataItems(mGoogleApiClient).setResultCallback(new ResultCallback<DataItemBuffer>() { @Override public void onResult(DataItemBuffer result) { try { if (result.getStatus().isSuccess()) { resetDataItems(result); } else { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Reset quiz: failed to get Data Items to reset"); } } } finally { result.release(); } } }); } else { Log.e(TAG, "Failed to reset data items because client is disconnected from " + "Google Play Services"); } setHasQuestionBeenAsked(false); mNumCorrect = 0; mNumIncorrect = 0; mNumSkipped = 0; }
From source file:com.bm.demo.TabViewPager.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.setBackgroundResource(R.color.oriange); // 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)); }/* w ww . j a va2s . c o m*/ } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); tab.setBackgroundResource(R.color.white); } } } }
From source file:com.android.inputmethod.latin.suggestions.SuggestionStripLayoutHelper.java
public void layoutAddToDictionaryHint(final String word, final ViewGroup addToDictionaryStrip) { final boolean shouldShowUiToAcceptTypedWord = Settings.getInstance() .getCurrent().mShouldShowUiToAcceptTypedWord; final int stripWidth = addToDictionaryStrip.getWidth(); final int width = shouldShowUiToAcceptTypedWord ? stripWidth : stripWidth - mDividerWidth - mPadding * 2; final TextView wordView = (TextView) addToDictionaryStrip.findViewById(R.id.word_to_save); wordView.setTextColor(mColorTypedWord); final int wordWidth = (int) (width * mCenterSuggestionWeight); final CharSequence wordToSave = getEllipsizedText(word, wordWidth, wordView.getPaint()); final float wordScaleX = wordView.getTextScaleX(); wordView.setText(wordToSave);// w w w . j a va 2 s .c om wordView.setTextScaleX(wordScaleX); setLayoutWeight(wordView, mCenterSuggestionWeight, ViewGroup.LayoutParams.MATCH_PARENT); final int wordVisibility = shouldShowUiToAcceptTypedWord ? View.GONE : View.VISIBLE; wordView.setVisibility(wordVisibility); addToDictionaryStrip.findViewById(R.id.word_to_save_divider).setVisibility(wordVisibility); final Resources res = addToDictionaryStrip.getResources(); final CharSequence hintText; final int hintWidth; final float hintWeight; final TextView hintView = (TextView) addToDictionaryStrip.findViewById(R.id.hint_add_to_dictionary); if (shouldShowUiToAcceptTypedWord) { hintText = res.getText(R.string.hint_add_to_dictionary_without_word); hintWidth = width; hintWeight = 1.0f; hintView.setGravity(Gravity.CENTER); } else { final boolean isRtlLanguage = (ViewCompat .getLayoutDirection(addToDictionaryStrip) == ViewCompat.LAYOUT_DIRECTION_RTL); final String arrow = isRtlLanguage ? RIGHTWARDS_ARROW : LEFTWARDS_ARROW; final boolean isRtlSystem = SubtypeLocaleUtils.isRtlLanguage(res.getConfiguration().locale); final CharSequence hint = res.getText(R.string.hint_add_to_dictionary); hintText = (isRtlLanguage == isRtlSystem) ? (arrow + hint) : (hint + arrow); hintWidth = width - wordWidth; hintWeight = 1.0f - mCenterSuggestionWeight; hintView.setGravity(Gravity.CENTER_VERTICAL | Gravity.START); } hintView.setTextColor(mColorAutoCorrect); final float hintScaleX = getTextScaleX(hintText, hintWidth, hintView.getPaint()); hintView.setText(hintText); hintView.setTextScaleX(hintScaleX); setLayoutWeight(hintView, hintWeight, ViewGroup.LayoutParams.MATCH_PARENT); }