List of usage examples for android.widget TextView setTextColor
@android.view.RemotableViewMethod public void setTextColor(ColorStateList colors)
From source file:com.example.inmarsat.hellomap.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); setUpMapIfNeeded();/* w w w. ja v a 2 s .c o m*/ // set the background of the text view showing the data from the API calls if (findViewById(R.id.detailsText) != null) { TextView view = (TextView) findViewById(R.id.detailsText); view.setBackgroundColor(Color.BLACK); view.setTextColor(Color.WHITE); } }
From source file:kr.co.generic.wifianalyzer.wifi.AccessPointDetail.java
private void setViewCompact(@NonNull Context context, @NonNull View view, @NonNull WiFiDetail wiFiDetail, boolean isChild) { ((TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.ssid)).setText(wiFiDetail.getTitle()); WiFiSignal wiFiSignal = wiFiDetail.getWiFiSignal(); Strength strength = wiFiSignal.getStrength(); Security security = wiFiDetail.getSecurity(); ImageView securityImage = (ImageView) view.findViewById(kr.co.generic.wifianalyzer.R.id.securityImage); securityImage.setImageResource(security.imageResource()); securityImage/* w w w .ja v a 2s . co m*/ .setColorFilter(ContextCompat.getColor(context, kr.co.generic.wifianalyzer.R.color.icons_color)); TextView textLevel = (TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.level); textLevel.setText(String.format(Locale.ENGLISH, "%ddBm", wiFiSignal.getLevel())); textLevel.setTextColor(ContextCompat.getColor(context, strength.colorResource())); ((TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.channel)) .setText(wiFiSignal.getChannelDisplay()); ((TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.primaryFrequency)).setText(String .format(Locale.ENGLISH, "%d%s", wiFiSignal.getPrimaryFrequency(), WiFiSignal.FREQUENCY_UNITS)); ((TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.distance)) .setText(String.format(Locale.ENGLISH, "%5.1fm", wiFiSignal.getDistance())); if (isChild) { view.findViewById(kr.co.generic.wifianalyzer.R.id.tab).setVisibility(View.VISIBLE); } else { view.findViewById(kr.co.generic.wifianalyzer.R.id.tab).setVisibility(View.GONE); } }
From source file:com.eyekabob.EventInfo.java
protected void loadEvent(JSONObject response) { try {/* www. java 2 s. c o m*/ JSONObject jsonEvent = response.getJSONObject("event"); artists = new ArrayList<String>(); title = jsonEvent.getString("title"); JSONObject jsonAllArtists = jsonEvent.getJSONObject("artists"); headliner = jsonAllArtists.getString("headliner"); Object artistObj = jsonAllArtists.get("artist"); JSONArray jsonOpeners = new JSONArray(); if (artistObj instanceof JSONArray) { jsonOpeners = (JSONArray) artistObj; } for (int i = 0; i < jsonOpeners.length(); i++) { String artistName = jsonOpeners.getString(i); if (!headliner.equals(artistName)) { artists.add(artistName); } } JSONObject jsonVenue = jsonEvent.getJSONObject("venue"); venue = jsonVenue.optString("name"); venueCity = jsonVenue.optString("city"); venueStreet = jsonVenue.optString("street"); venueUrl = jsonVenue.optString("url"); startDate = EyekabobHelper.LastFM.toReadableDate(jsonEvent.getString("startDate")); JSONObject image = EyekabobHelper.LastFM.getLargestJSONImage(jsonEvent.getJSONArray("image")); imageUrl = image.getString("#text"); } catch (JSONException e) { Log.e(getClass().getName(), "", e); } try { new EventImageTask().execute(new URL(imageUrl)); } catch (MalformedURLException e) { Log.e(getClass().getName(), "Bad image URL [" + imageUrl + "]", e); } TextView titleView = (TextView) findViewById(R.id.infoMainHeader); titleView.setText(title); TextView headlinerView = (TextView) findViewById(R.id.infoSubHeaderOne); // TODO: I18N headlinerView.setText("Headlining: " + headliner); TextView dateTimeView = (TextView) findViewById(R.id.infoSubHeaderTwo); dateTimeView.setText(startDate); if (!startDate.equals("")) { Button tixButton = (Button) findViewById(R.id.infoTicketsButton); tixButton.setVisibility(View.VISIBLE); } LinearLayout artistsView = (LinearLayout) findViewById(R.id.infoFutureEventsContent); TextView alsoPerformingView = (TextView) findViewById(R.id.infoFutureEventsHeader); if (!artists.isEmpty()) { // TODO: I18N alsoPerformingView.setText("Also Performing:"); for (String artist : artists) { TextView row = new TextView(this); row.setTextColor(Color.WHITE); row.setText(artist); row.setPadding(20, 0, 0, 20); // Left and bottom padding artistsView.addView(row); } } String venueDesc = ""; TextView venueView = (TextView) findViewById(R.id.infoEventVenue); // TODO: Padding instead of whitespace venueDesc += " " + venue; if (!venueCity.equals("") && !venueStreet.equals("")) { // TODO: I18N venueDesc += "\n Address: " + venueStreet + "\n" + venueCity; } // TODO: Padding instead of whitespace venueDesc += "\n " + startDate; TextView venueTitleView = (TextView) findViewById(R.id.infoBioHeader); if (!venue.equals("") || !venueCity.equals("") || !venueStreet.equals("")) { // TODO: I18N venueTitleView.setText("Venue Details:"); View vView = findViewById(R.id.infoVenueDetails); vView.setVisibility(View.VISIBLE); } else { // TODO: I18N venueTitleView.setText("No Venue Details Available"); } venueView.setVisibility(View.VISIBLE); venueView.setText(venueDesc); TextView websiteView = (TextView) findViewById(R.id.infoVenueWebsite); if (!venueUrl.equals("")) { // TODO: I18N websiteView.setVisibility(View.VISIBLE); websiteView.setText(Html.fromHtml("<a href=\"" + venueUrl + "\">More Information</a>")); websiteView.setMovementMethod(LinkMovementMethod.getInstance()); } }
From source file:com.chenjishi.u148.view.TabPageIndicator.java
public void setTheme(int theme) { final boolean isNight = theme == Constants.MODE_NIGHT; setBackgroundColor(isNight ? 0xFF1C1C1C : 0xFFE5E5E5); final int tabCount = mTabLayout.getChildCount(); for (int i = 0; i < tabCount; i++) { final TextView child = (TextView) mTabLayout.getChildAt(i); child.setTextColor(getResources() .getColorStateList(isNight ? R.color.tab_text_color_night : R.color.tab_text_color)); child.setBackgroundResource(//from ww w. j av a2 s. c om isNight ? R.drawable.tab_indicator_night : R.drawable.abs__tab_indicator_ab_holo); } }
From source file:com.abid_mujtaba.fetchheaders.fragments.AccountFragment.java
private void setErrorView(String error_message) // Method for creating and displaying an Error Message View. { // TODO: Create a custom layout for Error TextViews in general to be used in such cases. Possibly add a triangular icon indicating an error. TextView tv = new TextView(getActivity()); tv.setText(error_message);/*from w ww. ja va2 s . c om*/ tv.setTextColor(getResources().getColor(R.color.red)); mEmailList.addView(tv); }
From source file:am.project.x.business.widgets.gradienttabstrip.GradientTabStripActivity.java
private ArrayList<View> getPagers() { ArrayList<View> views = new ArrayList<>(); for (int i = 0; i < 4; i++) { TextView text = new TextView(this); text.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 180); text.setText(String.format(Locale.getDefault(), "%d", i + 1)); text.setGravity(Gravity.CENTER); text.setTextColor(0xff000000); views.add(text);/*from w w w. j a v a 2 s. c o m*/ } return views; }
From source file:ch.pantas.billsplitter.ui.FixedTabsView.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { TextView v = (TextView) tabsContainer.getChildAt(i); TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_DIP, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); tab.setAllCaps(textAllCaps);// w w w . ja v a2s .co m } }
From source file:cn.wander.Utils.views.pageindicator.TabPageIndicator.java
private void setColor(TextView tv, int color) { tv.setTextColor(color); }
From source file:com.brookmanholmes.bma.wizard.ui.ReviewFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { wizardModel = callbacks.onGetModel(); wizardModel.registerListener(this); onPageTreeChanged();/*from w w w . j a v a 2 s. c om*/ View rootView = inflater.inflate(R.layout.fragment_page, container, false); TextView titleView = (TextView) rootView.findViewById(android.R.id.title); titleView.setText(R.string.title_review); titleView.setTextColor(ContextCompat.getColor(getContext(), R.color.colorAccent)); ListView listView = (ListView) rootView.findViewById(android.R.id.list); setListAdapter(reviewAdapter); listView.setDividerHeight(0); listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); return rootView; }
From source file:com.checktipsplitter.wizard.ui.ReviewFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_page, container, false); TextView titleView = (TextView) rootView.findViewById(android.R.id.title); titleView.setText(R.string.review_title); titleView.setTextColor(getResources().getColor(R.color.review_green)); ListView listView = (ListView) rootView.findViewById(android.R.id.list); setListAdapter(mReviewAdapter);// w ww . java 2 s.c o m listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); return rootView; }