List of usage examples for android.graphics.drawable GradientDrawable setColor
public void setColor(@Nullable ColorStateList colorStateList)
From source file:org.onebusaway.android.report.ui.SimpleArrivalListFragment.java
private void loadArrivalList(ObaArrivalInfo[] info, final ObaReferences refs, long currentTime) { LinearLayout contentLayout = (LinearLayout) getActivity().findViewById(R.id.simple_arrival_content); contentLayout.removeAllViews();/*from w w w . j a v a 2 s. c o m*/ ArrayList<ArrivalInfo> arrivalInfos = ArrivalInfoUtils.convertObaArrivalInfo(getActivity(), info, new ArrayList<String>(), currentTime, false); for (ArrivalInfo stopInfo : arrivalInfos) { final ObaArrivalInfo arrivalInfo = stopInfo.getInfo(); LayoutInflater inflater = LayoutInflater.from(getActivity()); LinearLayout view = (LinearLayout) inflater.inflate(R.layout.arrivals_list_item, null, false); view.setBackgroundColor(getResources().getColor(R.color.material_background)); TextView route = (TextView) view.findViewById(R.id.route); TextView destination = (TextView) view.findViewById(R.id.destination); TextView time = (TextView) view.findViewById(R.id.time); TextView status = (TextView) view.findViewById(R.id.status); TextView etaView = (TextView) view.findViewById(R.id.eta); TextView minView = (TextView) view.findViewById(R.id.eta_min); ViewGroup realtimeView = (ViewGroup) view.findViewById(R.id.eta_realtime_indicator); view.findViewById(R.id.more_horizontal).setVisibility(View.INVISIBLE); view.findViewById(R.id.route_favorite).setVisibility(View.INVISIBLE); String routeShortName = arrivalInfo.getShortName(); route.setText(routeShortName); UIUtils.maybeShrinkRouteName(getActivity(), route, routeShortName); destination.setText(UIUtils.formatDisplayText(arrivalInfo.getHeadsign())); status.setText(stopInfo.getStatusText()); long eta = stopInfo.getEta(); if (eta == 0) { etaView.setText(R.string.stop_info_eta_now); minView.setVisibility(View.GONE); } else { etaView.setText(String.valueOf(eta)); minView.setVisibility(View.VISIBLE); } status.setBackgroundResource(R.drawable.round_corners_style_b_status); GradientDrawable d = (GradientDrawable) status.getBackground(); Integer colorCode = stopInfo.getColor(); int color = getActivity().getResources().getColor(colorCode); if (stopInfo.getPredicted()) { // Show real-time indicator UIUtils.setRealtimeIndicatorColorByResourceCode(realtimeView, colorCode, android.R.color.transparent); realtimeView.setVisibility(View.VISIBLE); } else { realtimeView.setVisibility(View.INVISIBLE); } etaView.setTextColor(color); minView.setTextColor(color); d.setColor(color); // Set padding on status view int pSides = UIUtils.dpToPixels(getActivity(), 5); int pTopBottom = UIUtils.dpToPixels(getActivity(), 2); status.setPadding(pSides, pTopBottom, pSides, pTopBottom); time.setText(DateUtils.formatDateTime(getActivity(), stopInfo.getDisplayTime(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_NO_NOON | DateUtils.FORMAT_NO_MIDNIGHT)); View reminder = view.findViewById(R.id.reminder); reminder.setVisibility(View.GONE); contentLayout.addView(view); view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String agencyName = findAgencyNameByRouteId(refs, arrivalInfo.getRouteId()); mCallback.onArrivalItemClicked(arrivalInfo, agencyName); } }); } }
From source file:com.auth0.android.lock.views.ValidatedInputView.java
/** * Updates the view knowing if the input is valid or not. * * @param isValid if the input is valid or not for this kind of DataType. *//*from w w w . j av a2 s . c om*/ @CallSuper protected void updateBorder(boolean isValid) { ViewGroup parent = ((ViewGroup) input.getParent()); Drawable bg = parent.getBackground(); GradientDrawable gd = bg == null ? new GradientDrawable() : (GradientDrawable) bg; gd.setCornerRadius(getResources().getDimensionPixelSize(R.dimen.com_auth0_lock_widget_corner_radius)); int strokeColor = isValid ? R.color.com_auth0_lock_input_field_border_normal : R.color.com_auth0_lock_input_field_border_error; gd.setStroke(getResources().getDimensionPixelSize(R.dimen.com_auth0_lock_input_field_stroke_width), ContextCompat.getColor(getContext(), strokeColor)); gd.setColor(ContextCompat.getColor(getContext(), R.color.com_auth0_lock_input_field_border_normal)); ViewUtils.setBackground(parent, gd); errorDescription.setVisibility(isValid ? INVISIBLE : VISIBLE); requestLayout(); }
From source file:co.ceryle.segmentedbutton.SegmentedButtonGroup.java
private void setBorderAttrs() { borderView = findViewById(R.id.border); borderParams = (RelativeLayout.LayoutParams) borderView.getLayoutParams(); borderParams.setMargins(margin - borderSize, margin - borderSize, margin - borderSize, margin - borderSize); if (borderSize > 0) { GradientDrawable gd = new GradientDrawable(); gd.setColor(borderColor); gd.setCornerRadius(radius + 3); // TODO Util.setBackground(borderView, gd); }/*from ww w. j a v a2 s. co m*/ }
From source file:org.onebusaway.android.ui.TripDetailsListFragment.java
private void setUpHeader() { ObaTripStatus status = mTripInfo.getStatus(); ObaReferences refs = mTripInfo.getRefs(); Context context = getActivity(); String tripId = mTripInfo.getId(); ObaTrip trip = refs.getTrip(tripId); ObaRoute route = refs.getRoute(trip.getRouteId()); TextView shortName = (TextView) getView().findViewById(R.id.short_name); shortName.setText(route.getShortName()); TextView longName = (TextView) getView().findViewById(R.id.long_name); longName.setText(trip.getHeadsign()); TextView agency = (TextView) getView().findViewById(R.id.agency); agency.setText(refs.getAgency(route.getAgencyId()).getName()); TextView vehicleView = (TextView) getView().findViewById(R.id.vehicle); TextView vehicleDeviation = (TextView) getView().findViewById(R.id.status); ViewGroup realtime = (ViewGroup) getView().findViewById(R.id.eta_realtime_indicator); realtime.setVisibility(View.GONE); ViewGroup statusLayout = (ViewGroup) getView().findViewById(R.id.status_layout); if (status == null) { // Show schedule info only vehicleView.setText(null);//from w w w . j av a 2 s . c o m vehicleView.setVisibility(View.GONE); vehicleDeviation.setText(context.getString(R.string.trip_details_scheduled_data)); return; } if (!TextUtils.isEmpty(status.getVehicleId())) { // Show vehicle info vehicleView.setText(context.getString(R.string.trip_details_vehicle, status.getVehicleId())); vehicleView.setVisibility(View.VISIBLE); } else { vehicleView.setVisibility(View.GONE); } // Set status color in header statusLayout.setBackgroundResource(R.drawable.round_corners_style_b_header_status); GradientDrawable d = (GradientDrawable) statusLayout.getBackground(); int statusColor; if (!status.isPredicted()) { // We have only schedule info, but the bus position can still be interpolated vehicleDeviation.setText(context.getString(R.string.trip_details_scheduled_data)); statusColor = R.color.stop_info_scheduled_time; d.setColor(getResources().getColor(statusColor)); return; } /** * We have real-time info */ realtime.setVisibility(View.VISIBLE); long deviation = status.getScheduleDeviation(); long deviationMin = TimeUnit.SECONDS.toMinutes(status.getScheduleDeviation()); long minutes = Math.abs(deviation) / 60; long seconds = Math.abs(deviation) % 60; String lastUpdate = DateUtils.formatDateTime(getActivity(), status.getLastUpdateTime(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_NO_NOON | DateUtils.FORMAT_NO_MIDNIGHT); statusColor = ArrivalInfo.computeColorFromDeviation(deviationMin); if (statusColor != R.color.stop_info_ontime) { // Show early/late/scheduled color d.setColor(getResources().getColor(statusColor)); } else { // For on-time, use header default color d.setColor(getResources().getColor(R.color.theme_primary)); } if (deviation >= 0) { if (deviation < 60) { vehicleDeviation .setText(context.getString(R.string.trip_details_real_time_sec_late, seconds, lastUpdate)); } else { vehicleDeviation.setText(context.getString(R.string.trip_details_real_time_min_sec_late, minutes, seconds, lastUpdate)); } } else { if (deviation > -60) { vehicleDeviation .setText(context.getString(R.string.trip_details_real_time_sec_early, seconds, lastUpdate)); } else { vehicleDeviation.setText(context.getString(R.string.trip_details_real_time_min_sec_early, minutes, seconds, lastUpdate)); } } }
From source file:com.filemanager.free.adapters.Recycleradapter.java
@Override public void onBindViewHolder(RecyclerView.ViewHolder vholder, @SuppressLint("RecyclerView") final int p) { final Recycleradapter.ViewHolder holder = ((Recycleradapter.ViewHolder) vholder); if (main.IS_LIST) { if (p == getItemCount() - 1) { holder.rl.setMinimumHeight(rowHeight); if (items.size() == (main.GO_BACK_ITEM ? 1 : 0)) holder.txtTitle.setText(R.string.nofiles); else { holder.txtTitle.setText(R.string.footer); }/*from w w w .j a v a2 s . c o m*/ return; } } if (holder.imageView == null) return; if (!this.stoppedAnimation && !myanim.get(p)) { animate(holder); myanim.put(p, true); } final Layoutelements rowItem = items.get(p); if (main.IS_LIST) { holder.rl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { main.onListItemClicked(p, v); } }); holder.rl.setOnLongClickListener(new View.OnLongClickListener() { public boolean onLongClick(View p1) { if (!rowItem.getSize().equals(main.goback)) { Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim); holder.imageView.setAnimation(iconAnimation); toggleChecked(p); } return true; } }); filetype = -1; if (Icons.isPicture((rowItem.getDesc().toLowerCase()))) filetype = 0; else if (Icons.isApk((rowItem.getDesc()))) filetype = 1; else if (Icons.isVideo(rowItem.getDesc())) filetype = 2; holder.txtTitle.setText(rowItem.getTitle()); holder.imageView.setImageDrawable(rowItem.getImageId()); holder.ext.setText(""); if (holder.about != null) { if (main.theme1 == 0) holder.about.setColorFilter(grey_color); showPopup(holder.about, rowItem); } holder.imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!rowItem.getSize().equals(main.goback)) { Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim); holder.imageView.setAnimation(iconAnimation); toggleChecked(p); } else main.goBack(); } }); holder.viewmageV.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!rowItem.getSize().equals(main.goback)) { Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim); holder.imageView.setAnimation(iconAnimation); toggleChecked(p); } else main.goBack(); } }); holder.apk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!rowItem.getSize().equals(main.goback)) { Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim); holder.imageView.setAnimation(iconAnimation); toggleChecked(p); } else main.goBack(); } }); holder.imageView.setVisibility(View.VISIBLE); holder.viewmageV.setVisibility(View.INVISIBLE); if (filetype == 0) { if (main.SHOW_THUMBS) { if (main.CIRCULAR_IMAGES) { holder.imageView.setVisibility(View.GONE); holder.apk.setVisibility(View.GONE); holder.viewmageV.setVisibility(View.VISIBLE); holder.viewmageV.setImageDrawable(main.DARK_IMAGE); main.ic.cancelLoad(holder.viewmageV); main.ic.loadDrawable(holder.viewmageV, (rowItem.getDesc()), null); } else { holder.imageView.setVisibility(View.GONE); holder.apk.setVisibility(View.VISIBLE); holder.apk.setImageDrawable(main.DARK_IMAGE); main.ic.cancelLoad(holder.apk); main.ic.loadDrawable(holder.apk, (rowItem.getDesc()), null); } } } else if (filetype == 1) { if (main.SHOW_THUMBS) { holder.viewmageV.setVisibility(View.GONE); holder.imageView.setVisibility(View.GONE); holder.apk.setVisibility(View.VISIBLE); holder.apk.setImageDrawable(main.apk); main.ic.cancelLoad(holder.apk); main.ic.loadDrawable(holder.apk, (rowItem.getDesc()), null); } } else if (filetype == 2) { if (main.SHOW_THUMBS) { if (main.CIRCULAR_IMAGES) { holder.imageView.setVisibility(View.GONE); holder.viewmageV.setVisibility(View.VISIBLE); holder.viewmageV.setImageDrawable(main.DARK_VIDEO); main.ic.cancelLoad(holder.viewmageV); main.ic.loadDrawable(holder.viewmageV, (rowItem.getDesc()), null); } else { holder.imageView.setVisibility(View.GONE); holder.apk.setVisibility(View.VISIBLE); holder.apk.setImageDrawable(main.DARK_VIDEO); main.ic.cancelLoad(holder.apk); main.ic.loadDrawable(holder.apk, (rowItem.getDesc()), null); } } } else { holder.viewmageV.setVisibility(View.GONE); holder.apk.setVisibility(View.GONE); holder.imageView.setVisibility(View.VISIBLE); } Boolean checked = myChecked.get(p); if (checked != null) { if (main.theme1 == 0) { holder.rl.setBackgroundResource(R.drawable.safr_ripple_white); } else { holder.rl.setBackgroundResource(R.drawable.safr_ripple_black); } holder.rl.setSelected(false); if (checked) { holder.apk.setVisibility(View.GONE); holder.viewmageV.setVisibility(View.GONE); holder.imageView.setVisibility(View.VISIBLE); holder.imageView.setImageDrawable( ContextCompat.getDrawable(context, R.drawable.abc_ic_cab_done_holo_dark)); GradientDrawable gradientDrawable = (GradientDrawable) holder.imageView.getBackground(); gradientDrawable.setColor(c1); holder.rl.setSelected(true); holder.ext.setText(""); } else { GradientDrawable gradientDrawable = (GradientDrawable) holder.imageView.getBackground(); if (main.COLORISE_ICONS) { if (rowItem.isDirectory()) gradientDrawable.setColor(main.icon_skin_color); else if (Icons.isVideo(rowItem.getDesc()) || Icons.isPicture(rowItem.getDesc())) gradientDrawable.setColor(c2); else if (Icons.isAudio(rowItem.getDesc())) gradientDrawable.setColor(c3); else if (Icons.isPdf(rowItem.getDesc())) gradientDrawable.setColor(c4); else if (Icons.isCode(rowItem.getDesc())) gradientDrawable.setColor(c5); else if (Icons.isText(rowItem.getDesc())) gradientDrawable.setColor(c6); else if (Icons.isArchive(rowItem.getDesc())) gradientDrawable.setColor(c7); else if (Icons.isApk(rowItem.getDesc())) gradientDrawable.setColor(c8); else if (Icons.isgeneric(rowItem.getDesc())) { gradientDrawable.setColor(c9); String ext = MimeTypes.getExtension(new File(rowItem.getDesc()).getName()); if (ext != null && ext.trim().length() != 0) { holder.ext.setText(ext); holder.imageView.setImageDrawable(null); } } else { gradientDrawable.setColor(main.icon_skin_color); } } else gradientDrawable.setColor((main.icon_skin_color)); if (rowItem.getSize().equals(main.goback)) gradientDrawable.setColor(c1); } } if (main.SHOW_PERMISSIONS) holder.perm.setText(rowItem.getPermissions()); if (main.SHOW_LAST_MODIFIED) holder.date.setText(rowItem.getDate()); String size = rowItem.getSize(); if (size.equals(main.goback)) { holder.date.setText(size); holder.txtDesc.setText(""); } else if (main.SHOW_SIZE) holder.txtDesc.setText(rowItem.getSize()); } else { Boolean checked = myChecked.get(p); holder.rl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { main.onListItemClicked(p, v); } }); holder.rl.setOnLongClickListener(new View.OnLongClickListener() { public boolean onLongClick(View p1) { if (!rowItem.getSize().equals(main.goback)) { Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim); holder.imageView.setAnimation(iconAnimation); toggleChecked(p); } return true; } }); holder.txtTitle.setText(rowItem.getTitle()); holder.imageView1.setVisibility(View.INVISIBLE); holder.imageView.setVisibility(View.VISIBLE); holder.imageView.setImageDrawable(rowItem.getImageId()); if (Icons.isPicture((rowItem.getDesc().toLowerCase())) || Icons.isVideo(rowItem.getDesc().toLowerCase())) { holder.imageView.setColorFilter(null); holder.imageView1.setVisibility(View.VISIBLE); holder.imageView1.setImageDrawable(null); if (main.theme == 1) holder.imageView1.setBackgroundColor(Color.BLACK); main.ic.cancelLoad(holder.imageView1); main.ic.loadDrawable(holder.imageView1, (rowItem.getDesc()), null); } else if (Icons.isApk((rowItem.getDesc()))) { holder.imageView.setColorFilter(null); main.ic.cancelLoad(holder.imageView); main.ic.loadDrawable(holder.imageView, (rowItem.getDesc()), null); } if (rowItem.isDirectory()) holder.imageView.setColorFilter(main.icon_skin_color); else if (Icons.isVideo(rowItem.getDesc())) holder.imageView.setColorFilter(c2); else if (Icons.isAudio(rowItem.getDesc())) holder.imageView.setColorFilter(c3); else if (Icons.isPdf(rowItem.getDesc())) holder.imageView.setColorFilter(c4); else if (Icons.isCode(rowItem.getDesc())) holder.imageView.setColorFilter(c5); else if (Icons.isText(rowItem.getDesc())) holder.imageView.setColorFilter(c6); else if (Icons.isArchive(rowItem.getDesc())) holder.imageView.setColorFilter(c7); else if (Icons.isgeneric(rowItem.getDesc())) holder.imageView.setColorFilter(c9); else if (Icons.isApk(rowItem.getDesc()) || Icons.isPicture(rowItem.getDesc())) holder.imageView.setColorFilter(null); else holder.imageView.setColorFilter(main.icon_skin_color); if (rowItem.getSize().equals(main.goback)) holder.imageView.setColorFilter(c1); if (checked != null) { if (checked) { holder.imageView.setColorFilter(main.icon_skin_color); holder.imageView.setImageDrawable( ContextCompat.getDrawable(context, R.drawable.abc_ic_cab_done_holo_dark)); holder.rl.setBackgroundColor(Color.parseColor("#9f757575")); } else { if (main.theme1 == 0) holder.rl.setBackgroundResource(R.drawable.item_doc_grid); else { holder.rl.setBackgroundResource(R.drawable.ic_grid_card_background_dark); holder.rl.findViewById(R.id.icon_frame).setBackgroundColor(Color.parseColor("#303030")); } } } if (holder.about != null) { if (main.theme1 == 0) holder.about.setColorFilter(grey_color); showPopup(holder.about, rowItem); } if (main.SHOW_LAST_MODIFIED) holder.date.setText(rowItem.getDate()); if (rowItem.getSize().equals(main.goback)) { holder.date.setText(rowItem.getSize()); holder.txtDesc.setText(""); } /*else if(main.SHOW_SIZE) holder.txtDesc.setText(rowItem.getSize()); */ if (main.SHOW_PERMISSIONS) holder.perm.setText(rowItem.getPermissions()); } }
From source file:am.widget.basetabstrip.BaseTabStrip.java
/** * ?Tag/*from www.j a v a 2 s . co m*/ * * @return Tag */ @SuppressWarnings("unused") protected Drawable getDefaultTagBackground() { final float density = getResources().getDisplayMetrics().density; final GradientDrawable mBackground = new GradientDrawable(); mBackground.setShape(GradientDrawable.RECTANGLE); mBackground.setColor(0xffff4444); mBackground.setCornerRadius(100000 * density); mBackground.setSize((int) (10 * density), (int) (10 * density)); return mBackground; }
From source file:com.nihaskalam.progressbuttonlibrary.CircularProgressButton.java
private StrokeGradientDrawable createDrawable(int color) { GradientDrawable drawable = (GradientDrawable) ContextCompat .getDrawable(getContext(), R.drawable.pb_background).mutate(); drawable.setColor(color); drawable.setCornerRadius(mCornerRadius); StrokeGradientDrawable strokeGradientDrawable = new StrokeGradientDrawable(drawable); strokeGradientDrawable.setStrokeColor(color); strokeGradientDrawable.setStrokeWidth(mStrokeWidth); return strokeGradientDrawable; }
From source file:org.tanrabad.survey.presenter.SurveyResultDialogFragment.java
private void setPlaceBackgroundIcon(JsonEntomology jsonEntomology) { GradientDrawable background = (GradientDrawable) placeIconView.getBackground(); int color;//from ww w. ja va 2 s . c om if (place.getType() == PlaceType.VILLAGE_COMMUNITY) { if (jsonEntomology.hiValue <= 10) color = ResourceUtils.from(getActivity()).getColor(R.color.without_larvae); else if (jsonEntomology.hiValue <= 50) color = ResourceUtils.from(getActivity()).getColor(R.color.amber_500); else color = ResourceUtils.from(getActivity()).getColor(R.color.have_larvae); } else { if (jsonEntomology.ciValue == 0) color = ResourceUtils.from(getActivity()).getColor(R.color.without_larvae); else color = ResourceUtils.from(getActivity()).getColor(R.color.have_larvae); } background.setColor(color); }
From source file:org.onebusaway.android.ui.ArrivalsListHeader.java
/** * Sets the popup for the status/* w w w . jav a 2 s . c om*/ * * @param index 0 if this is for the top ETA row, 1 if it is for the second * @param color color resource id to use for the popup background * @param statusText text to show in the status popup * @return a new PopupWindow initialized based on the provided parameters */ private PopupWindow setupPopup(final int index, int color, String statusText) { LayoutInflater inflater = LayoutInflater.from(mContext); TextView statusView = (TextView) inflater.inflate(R.layout.arrivals_list_tv_template_style_b_status_large, null); statusView.setBackgroundResource(R.drawable.round_corners_style_b_status); GradientDrawable d = (GradientDrawable) statusView.getBackground(); if (color != R.color.stop_info_ontime) { // Show early/late color d.setColor(mResources.getColor(color)); } else { // For on-time, use header default color d.setColor(mResources.getColor(R.color.theme_primary)); } d.setStroke(UIUtils.dpToPixels(mContext, 1), mResources.getColor(R.color.header_text_color)); int pSides = UIUtils.dpToPixels(mContext, 5); int pTopBottom = UIUtils.dpToPixels(mContext, 2); statusView.setPadding(pSides, pTopBottom, pSides, pTopBottom); statusView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); statusView.measure(TextView.MeasureSpec.UNSPECIFIED, TextView.MeasureSpec.UNSPECIFIED); statusView.setText(statusText); PopupWindow p = new PopupWindow(statusView, statusView.getWidth(), statusView.getHeight()); p.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); p.setBackgroundDrawable(new ColorDrawable(mResources.getColor(android.R.color.transparent))); p.setOutsideTouchable(true); p.setTouchInterceptor(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { boolean touchInView; if (index == 0) { touchInView = UIUtils.isTouchInView(mEtaAndMin1, event); } else { touchInView = UIUtils.isTouchInView(mEtaAndMin2, event); } return touchInView; } }); return p; }
From source file:es.usc.citius.servando.calendula.fragments.ScheduleTimetableFragment.java
private void updateColors(View rootView) { int color = DB.patients().getActive(getActivity()).color(); ((TextView) rootView.findViewById(R.id.textView3)).setTextColor(color); ((TextView) rootView.findViewById(R.id.textView2)).setTextColor(color); (rootView.findViewById(R.id.imageView)).setBackgroundColor(color); (rootView.findViewById(R.id.imageView1)).setBackgroundColor(color); StateListDrawable sld = (StateListDrawable) rootView.findViewById(R.id.text_container).getBackground(); GradientDrawable shape = (GradientDrawable) sld.getCurrent(); shape.setColor(Color.parseColor("#ececec")); hourlyIntervalEditText.setTextColor(color); hourlyIntervalFrom.setTextColor(color); hourlyIntervalRepeatDose.setTextColor(color); buttonScheduleStart.setTextColor(color); buttonScheduleEnd.setTextColor(color); periodValue.setTextColor(color);/*from www. j a v a2 s. co m*/ periodRest.setTextColor(color); }