List of usage examples for android.graphics Typeface BOLD
int BOLD
To view the source code for android.graphics Typeface BOLD.
Click Source Link
From source file:org.miaowo.miaowo.util.Html.java
private static void withinParagraph(StringBuilder out, Spanned text, int start, int end, Context context) { int next;/*from w w w . j a va 2s . c om*/ for (int i = start; i < end; i = next) { next = text.nextSpanTransition(i, end, CharacterStyle.class); CharacterStyle[] style = text.getSpans(i, next, CharacterStyle.class); for (int j = 0; j < style.length; j++) { if (style[j] instanceof StyleSpan) { int s = ((StyleSpan) style[j]).getStyle(); if ((s & Typeface.BOLD) != 0) { out.append("<b>"); } if ((s & Typeface.ITALIC) != 0) { out.append("<i>"); } } if (style[j] instanceof TypefaceSpan) { String s = ((TypefaceSpan) style[j]).getFamily(); if ("monospace".equals(s)) { out.append("<tt>"); } } if (style[j] instanceof SuperscriptSpan) { out.append("<sup>"); } if (style[j] instanceof SubscriptSpan) { out.append("<sub>"); } if (style[j] instanceof UnderlineSpan) { out.append("<u>"); } if (style[j] instanceof StrikethroughSpan) { out.append("<span style=\"text-decoration:line-through;\">"); } if (style[j] instanceof URLSpan) { out.append("<a href=\""); out.append(((URLSpan) style[j]).getURL()); out.append("\">"); } if (style[j] instanceof ImageSpan) { out.append("<img src=\""); out.append(((ImageSpan) style[j]).getSource()); out.append("\">"); // Don't output the dummy character underlying the image. i = next; } if (style[j] instanceof AbsoluteSizeSpan) { AbsoluteSizeSpan s = ((AbsoluteSizeSpan) style[j]); float sizeDip = s.getSize(); if (!s.getDip()) { sizeDip /= context.getResources().getDisplayMetrics().density; } // px in CSS is the equivalance of dip in Android out.append(String.format("<span style=\"font-size:%.0fpx\";>", sizeDip)); } if (style[j] instanceof RelativeSizeSpan) { float sizeEm = ((RelativeSizeSpan) style[j]).getSizeChange(); out.append(String.format("<span style=\"font-size:%.2fem;\">", sizeEm)); } if (style[j] instanceof ForegroundColorSpan) { int color = ((ForegroundColorSpan) style[j]).getForegroundColor(); out.append(String.format("<span style=\"color:#%06X;\">", 0xFFFFFF & color)); } if (style[j] instanceof BackgroundColorSpan) { int color = ((BackgroundColorSpan) style[j]).getBackgroundColor(); out.append(String.format("<span style=\"background-color:#%06X;\">", 0xFFFFFF & color)); } } withinStyle(out, text, i, next); for (int j = style.length - 1; j >= 0; j--) { if (style[j] instanceof BackgroundColorSpan) { out.append("</span>"); } if (style[j] instanceof ForegroundColorSpan) { out.append("</span>"); } if (style[j] instanceof RelativeSizeSpan) { out.append("</span>"); } if (style[j] instanceof AbsoluteSizeSpan) { out.append("</span>"); } if (style[j] instanceof URLSpan) { out.append("</a>"); } if (style[j] instanceof StrikethroughSpan) { out.append("</span>"); } if (style[j] instanceof UnderlineSpan) { out.append("</u>"); } if (style[j] instanceof SubscriptSpan) { out.append("</sub>"); } if (style[j] instanceof SuperscriptSpan) { out.append("</sup>"); } if (style[j] instanceof TypefaceSpan) { String s = ((TypefaceSpan) style[j]).getFamily(); if (s.equals("monospace")) { out.append("</tt>"); } } if (style[j] instanceof StyleSpan) { int s = ((StyleSpan) style[j]).getStyle(); if ((s & Typeface.BOLD) != 0) { out.append("</b>"); } if ((s & Typeface.ITALIC) != 0) { out.append("</i>"); } } } } }
From source file:com.seatgeek.placesautocompletedemo.MainFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.fragment_main, container, false); mapActivity = getActivity();/* www . j a v a 2 s. c om*/ dataProvider = new DataProvider(mapActivity); placePickerGoogle(placePickerIntent); tinydb = new TinyDB(getContext()); arrayListBookmark = tinydb.getListString("BOOKMARK"); recyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_cmt); scrollView = (NestedScrollView) rootView.findViewById(R.id.scrollView); mAdapter = new MessagesAdapter(getContext(), messages, this); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getContext()); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.addItemDecoration(new DividerItemDecoration(getContext(), LinearLayoutManager.VERTICAL)); recyclerView.setAdapter(mAdapter); recyclerView.setNestedScrollingEnabled(false); recyclerView.setFocusable(false); scrollView.scrollTo(0, 0); // mListView = (LockableRecyclerView) rootView.findViewById(android.R.id.list); // mListView.setOverScrollMode(ListView.OVER_SCROLL_NEVER); searchLocation = (CardView) rootView.findViewById(R.id.search_bar); searchLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); startActivityForResult(placePickerIntent, PLACE_AUTOCOMPLETE_REQUEST_CODE); } }); final LayoutInflater inflatera = (LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); customView = inflatera.inflate(R.layout.review, null); dialogReview = new MaterialStyledDialog.Builder(getActivity()).setHeaderDrawable(R.drawable.header_2) .setCustomView(customView, 20, 20, 20, 0).build(); btn_Rate = (Button) rootView.findViewById(R.id.btn_rate); btn_book = (Button) rootView.findViewById(R.id.btn_book); btn_Rate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // if (customView != null) { // ViewGroup parent = (ViewGroup) customView.getParent(); // if (parent != null) { // parent.removeView(customView); // } // } // try { // customView = inflatera.inflate(R.layout.review,null); // } catch (InflateException e) { // // } // dialogHeader_4.getBuilder().setCustomView(customView,20,20,20,0); dialogReview.show(); } }); btn_book.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (arrayListBookmark.contains(currentPos)) { btn_book.setBackgroundResource(R.drawable.star_off); arrayListBookmark.remove(currentPos); } else { btn_book.setBackgroundResource(R.drawable.star_on); arrayListBookmark.add(currentPos); } tinydb.putListString("BOOKMARK", arrayListBookmark); // btn_book.setBackgroundResource(R.drawable.star_on); } }); rating = (SmileRating) customView.findViewById(R.id.ratingsBar); final EditText ed_review = (EditText) customView.findViewById(R.id.reviewED); final EditText ed_title = (EditText) customView.findViewById(R.id.titleED); Button cancelDialog = (Button) customView.findViewById(R.id.cancelD); cancelDialog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialogReview.dismiss(); } }); Button submitDialog = (Button) customView.findViewById(R.id.submitD); submitDialog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Toast.makeText(getActivity().getApplicationContext(),""+rating.getRating(),Toast.LENGTH_SHORT).show(); sendComment(10, ed_review.getText().toString().trim(), ed_title.getText().toString().trim(), rating.getRating(), new ParkingCar()); } }); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mapActivity); latitude = sharedPreferences.getString("LATITUDE", null); longitude = sharedPreferences.getString("LONGITUDE", null); RADIUS = sharedPreferences.getString("RADIUS", "1000"); ViewPager pager = (ViewPager) rootView.findViewById(R.id.pager); pager.setAdapter(new ImageAdapter(getActivity())); pager.setCurrentItem(getArguments().getInt(Constants.Extra.IMAGE_POSITION, 0)); pager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { for (int i = 0; i < dotsCount; i++) { dots[i].setTextColor(getResources().getColor(android.R.color.black)); } dots[position].setTextColor(Color.GREEN); } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { } }); setUiPageViewController(rootView); mLayout = (SlidingUpPanelLayout) rootView.findViewById(R.id.sliding_layout); mLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); mLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); mLayout.setAnchorPoint(0.68f); mLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() { @Override public void onPanelSlide(View panel, float slideOffset) { Log.i("", "onPanelSlide, offset " + slideOffset); } @Override public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) { Log.i("", "onPanelStateChanged " + newState); if (newState == SlidingUpPanelLayout.PanelState.COLLAPSED) { scrollView.scrollTo(0, 0); } } }); mLayout.setFadeOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); } }); txt_Adress = (TextView) rootView.findViewById(R.id.name); txt_Scale = (TextView) rootView.findViewById(R.id.txt_Scale); txt_Add = (TextView) rootView.findViewById(R.id.textView3); txt_Type = (TextView) rootView.findViewById(R.id.textView4); txt_Rate = (TextView) rootView.findViewById(R.id.textView5); Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "font/UTM Avo.ttf"); Typeface tf1 = Typeface.createFromAsset(getActivity().getAssets(), "font/UTM Dax.ttf"); txt_Adress.setTypeface(tf, Typeface.BOLD); txt_Scale.setTypeface(tf1, Typeface.BOLD); txt_Add.setTypeface(tf1, Typeface.BOLD); txt_Type.setTypeface(tf1, Typeface.BOLD); txt_Rate.setTypeface(tf1, Typeface.BOLD); collapseMap(); return rootView; }
From source file:com.github.irshulx.Components.InputExtensions.java
public void boldifyText(EditorControl tag, TextView editText, int textMode) { if (editorCore.containsStyle(tag.editorTextStyles, EditorTextStyle.BOLD)) { tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLD, Op.Delete); editText.setTypeface(getTypeface(textMode, Typeface.NORMAL)); } else if (editorCore.containsStyle(tag.editorTextStyles, EditorTextStyle.BOLDITALIC)) { tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLDITALIC, Op.Delete); tag = editorCore.updateTagStyle(tag, EditorTextStyle.ITALIC, Op.Insert); editText.setTypeface(getTypeface(textMode, Typeface.ITALIC)); } else if (editorCore.containsStyle(tag.editorTextStyles, EditorTextStyle.ITALIC)) { tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLDITALIC, Op.Insert); tag = editorCore.updateTagStyle(tag, EditorTextStyle.ITALIC, Op.Delete); editText.setTypeface(getTypeface(textMode, Typeface.BOLD_ITALIC)); } else {/*from w w w. j a v a 2 s . c o m*/ tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLD, Op.Insert); editText.setTypeface(getTypeface(textMode, Typeface.BOLD)); } editText.setTag(tag); }
From source file:org.mariotaku.twidere.view.holder.ActivityTitleSummaryViewHolder.java
private Spanned getTitleStringByFriends(int stringRes, int stringResMulti, ParcelableUser[] sources, Object[] targets) {//from w ww .j a v a 2 s.c o m if (sources == null || sources.length == 0) return null; final Context context = adapter.getContext(); final Resources resources = context.getResources(); final Configuration configuration = resources.getConfiguration(); final UserColorNameManager manager = adapter.getUserColorNameManager(); final boolean nameFirst = adapter.isNameFirst(); final SpannableString firstSourceName = new SpannableString( manager.getDisplayName(sources[0], nameFirst, false)); firstSourceName.setSpan(new StyleSpan(Typeface.BOLD), 0, firstSourceName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); final String displayName; final Object target = targets[0]; if (target instanceof ParcelableUser) { displayName = manager.getDisplayName((ParcelableUser) target, nameFirst, false); } else if (target instanceof ParcelableStatus) { displayName = manager.getDisplayName((ParcelableStatus) target, nameFirst, false); } else { throw new IllegalArgumentException(); } final SpannableString firstTargetName = new SpannableString(displayName); firstTargetName.setSpan(new StyleSpan(Typeface.BOLD), 0, firstTargetName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); if (sources.length == 1) { final String format = context.getString(stringRes); return SpanFormatter.format(configuration.locale, format, firstSourceName, firstTargetName); } else if (sources.length == 2) { final String format = context.getString(stringResMulti); final SpannableString secondSourceName = new SpannableString( manager.getDisplayName(sources[1], nameFirst, false)); secondSourceName.setSpan(new StyleSpan(Typeface.BOLD), 0, secondSourceName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return SpanFormatter.format(configuration.locale, format, firstSourceName, secondSourceName, firstTargetName); } else { final int othersCount = sources.length - 1; final SpannableString nOthers = new SpannableString( resources.getQuantityString(R.plurals.N_others, othersCount, othersCount)); nOthers.setSpan(new StyleSpan(Typeface.BOLD), 0, nOthers.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); final String format = context.getString(stringResMulti); return SpanFormatter.format(configuration.locale, format, firstSourceName, nOthers, firstTargetName); } }
From source file:org.sufficientlysecure.keychain.ui.ViewKeyKeybaseFragment.java
@Override public void onCryptoOperationError(KeybaseVerificationResult result) { result.createNotify(getActivity()).show(); SpannableStringBuilder ssb = new SpannableStringBuilder(); ssb.append(getString(R.string.keybase_proof_failure)); String msg = getString(result.getLog().getLast().mType.mMsgId); if (msg == null) { msg = getString(R.string.keybase_unknown_proof_failure); }/*ww w . j a va 2s.co m*/ StyleSpan bold = new StyleSpan(Typeface.BOLD); ssb.setSpan(bold, 0, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ssb.append("\n\n").append(msg); displaySpannableResult(ssb); }
From source file:nz.ac.auckland.lablet.script.components.TextComponent.java
public ScriptComponentViewHolder addHeader(String text, SheetGroupLayout parent) { TextComponent component = new TextComponent(script, text); component.setTypeface(Typeface.BOLD); addItemViewHolder(component, parent); return component; }
From source file:com.nttec.everychan.ui.presentation.HtmlParser.java
private void handleEndTag(String tag) { if (tag.equalsIgnoreCase("br")) { handleBr(mSpannableStringBuilder); } else if (tag.equalsIgnoreCase("p")) { handleP(mSpannableStringBuilder, mStartLength, mLastPTagLength); } else if (tag.equalsIgnoreCase("div")) { handleP(mSpannableStringBuilder, mStartLength, mLastPTagLength); } else if (tag.equalsIgnoreCase("strong")) { end(mSpannableStringBuilder, Bold.class, new StyleSpan(Typeface.BOLD)); } else if (tag.equalsIgnoreCase("b")) { end(mSpannableStringBuilder, Bold.class, new StyleSpan(Typeface.BOLD)); } else if (tag.equalsIgnoreCase("em")) { end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC)); } else if (tag.equalsIgnoreCase("cite")) { end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC)); } else if (tag.equalsIgnoreCase("dfn")) { end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC)); } else if (tag.equalsIgnoreCase("i")) { end(mSpannableStringBuilder, Italic.class, new StyleSpan(Typeface.ITALIC)); } else if (tag.equalsIgnoreCase("s")) { end(mSpannableStringBuilder, Strike.class, new StrikethroughSpan()); } else if (tag.equalsIgnoreCase("strike")) { end(mSpannableStringBuilder, Strike.class, new StrikethroughSpan()); } else if (tag.equalsIgnoreCase("del")) { end(mSpannableStringBuilder, Strike.class, new StrikethroughSpan()); } else if (tag.equalsIgnoreCase("big")) { end(mSpannableStringBuilder, Big.class, new RelativeSizeSpan(1.25f)); } else if (tag.equalsIgnoreCase("small")) { end(mSpannableStringBuilder, Small.class, new RelativeSizeSpan(0.8f)); } else if (tag.equalsIgnoreCase("font")) { endFont(mSpannableStringBuilder); } else if (tag.equalsIgnoreCase("blockquote")) { handleP(mSpannableStringBuilder, mStartLength, mLastPTagLength); endBlockquote(mSpannableStringBuilder, mColors); } else if (tag.equalsIgnoreCase("tt")) { end(mSpannableStringBuilder, Monospace.class, new TypefaceSpan("monospace")); } else if (tag.equalsIgnoreCase("code")) { end(mSpannableStringBuilder, Monospace.class, new TypefaceSpan("monospace")); } else if (tag.equalsIgnoreCase("ul")) { if (!mListTags.isEmpty()) mListTags.removeFirst();//ww w . ja v a2 s . co m } else if (tag.equalsIgnoreCase("ol")) { if (!mListTags.isEmpty()) mListTags.removeFirst(); } else if (tag.equalsIgnoreCase("li")) { //?? ?? <li> } else if (tag.equalsIgnoreCase("tr")) { handleTr(mSpannableStringBuilder, false); } else if (tag.equalsIgnoreCase("td")) { handleTd(mSpannableStringBuilder, false); } else if (tag.equalsIgnoreCase("a")) { endA(mSpannableStringBuilder); } else if (tag.equalsIgnoreCase("u")) { end(mSpannableStringBuilder, Underline.class, new UnderlineSpan()); } else if (tag.equalsIgnoreCase("sup")) { end(mSpannableStringBuilder, Super.class, new SuperscriptSpan()); } else if (tag.equalsIgnoreCase("sub")) { end(mSpannableStringBuilder, Sub.class, new SubscriptSpan()); } else if (tag.length() == 2 && Character.toLowerCase(tag.charAt(0)) == 'h' && tag.charAt(1) >= '1' && tag.charAt(1) <= '6') { handleP(mSpannableStringBuilder, mStartLength, mLastPTagLength); endHeader(mSpannableStringBuilder); } else if (tag.equalsIgnoreCase("span")) { endSpan(mSpannableStringBuilder, mColors, mOpenSpoilers); } else if (tag.equalsIgnoreCase("aibquote")) { end(mSpannableStringBuilder, Aibquote.class, new ForegroundColorSpan(mColors != null ? mColors.quoteForeground : Color.GREEN)); } else if (tag.equalsIgnoreCase("aibspoiler")) { endAibspoiler(mSpannableStringBuilder, mColors, mOpenSpoilers); } /* else if (mTagHandler != null) { mTagHandler.handleTag(false, tag, mSpannableStringBuilder, mReader); }*/ }
From source file:com.github.irshulx.Components.InputExtensions.java
public void italicizeText(EditorControl tag, TextView editText, int textMode) { if (editorCore.containsStyle(tag.editorTextStyles, EditorTextStyle.ITALIC)) { tag = editorCore.updateTagStyle(tag, EditorTextStyle.ITALIC, Op.Delete); editText.setTypeface(getTypeface(textMode, Typeface.NORMAL)); } else if (editorCore.containsStyle(tag.editorTextStyles, EditorTextStyle.BOLDITALIC)) { tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLDITALIC, Op.Delete); tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLD, Op.Insert); editText.setTypeface(getTypeface(textMode, Typeface.BOLD)); } else if (editorCore.containsStyle(tag.editorTextStyles, EditorTextStyle.BOLD)) { tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLDITALIC, Op.Insert); tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLD, Op.Delete); editText.setTypeface(getTypeface(textMode, Typeface.BOLD_ITALIC)); } else {//from w ww .j a va 2 s . c om tag = editorCore.updateTagStyle(tag, EditorTextStyle.ITALIC, Op.Insert); editText.setTypeface(getTypeface(textMode, Typeface.ITALIC)); } editText.setTag(tag); }
From source file:net.maa123.tatuky.MainActivity.java
private void setupSearchView() { searchView.attachNavigationDrawerToMenuButton(drawer.getDrawerLayout()); // Setup content descriptions for the different elements in the search view. final View leftAction = searchView.findViewById(R.id.left_action); leftAction.setContentDescription(getString(R.string.action_open_drawer)); searchView.setOnFocusChangeListener(new FloatingSearchView.OnFocusChangeListener() { @Override//from w w w. j a va 2 s . com public void onFocus() { leftAction.setContentDescription(getString(R.string.action_close)); } @Override public void onFocusCleared() { leftAction.setContentDescription(getString(R.string.action_open_drawer)); } }); View clearButton = searchView.findViewById(R.id.clear_btn); clearButton.setContentDescription(getString(R.string.action_clear)); searchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() { @Override public void onSearchTextChanged(String oldQuery, String newQuery) { if (!oldQuery.equals("") && newQuery.equals("")) { searchView.clearSuggestions(); return; } if (newQuery.length() < 3) { return; } searchView.showProgress(); mastodonAPI.searchAccounts(newQuery, false, 5).enqueue(new Callback<List<Account>>() { @Override public void onResponse(Call<List<Account>> call, Response<List<Account>> response) { if (response.isSuccessful()) { searchView.swapSuggestions(response.body()); searchView.hideProgress(); } else { searchView.hideProgress(); } } @Override public void onFailure(Call<List<Account>> call, Throwable t) { searchView.hideProgress(); } }); } }); searchView.setOnSearchListener(new FloatingSearchView.OnSearchListener() { @Override public void onSuggestionClicked(SearchSuggestion searchSuggestion) { Account accountSuggestion = (Account) searchSuggestion; Intent intent = new Intent(MainActivity.this, AccountActivity.class); intent.putExtra("id", accountSuggestion.id); startActivity(intent); } @Override public void onSearchAction(String currentQuery) { } }); searchView.setOnBindSuggestionCallback(new SearchSuggestionsAdapter.OnBindSuggestionCallback() { @Override public void onBindSuggestion(View suggestionView, ImageView leftIcon, TextView textView, SearchSuggestion item, int itemPosition) { Account accountSuggestion = ((Account) item); Picasso.with(MainActivity.this).load(accountSuggestion.avatar) .placeholder(R.drawable.avatar_default).into(leftIcon); String searchStr = accountSuggestion.getDisplayName() + " " + accountSuggestion.username; final SpannableStringBuilder str = new SpannableStringBuilder(searchStr); str.setSpan(new StyleSpan(Typeface.BOLD), 0, accountSuggestion.getDisplayName().length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(str); textView.setMaxLines(1); textView.setEllipsize(TextUtils.TruncateAt.END); } }); }
From source file:com.saulcintero.moveon.fragments.Summary4.java
private XYMultipleSeriesRenderer getRenderer() { XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); XYSeriesRenderer r = new XYSeriesRenderer(); TypedValue outValue1 = new TypedValue(); TypedValue outValue2 = new TypedValue(); TypedValue outValue3 = new TypedValue(); TypedValue outValue4 = new TypedValue(); mContext.getResources().getValue(R.dimen.xy_chart_text_size_value, outValue1, true); mContext.getResources().getValue(R.dimen.xy_labels_text_size_value, outValue2, true); mContext.getResources().getValue(R.dimen.xy_axis_title_text_size_value, outValue3, true); mContext.getResources().getValue(R.dimen.xy_legend_text_size_value, outValue4, true); float xyChartTextSizeValue = outValue1.getFloat(); float xyLabelsTextSizeValue = outValue1.getFloat(); float xyAxisTitleTextSizeValue = outValue1.getFloat(); float xyLegendTextSizeValue = outValue1.getFloat(); r = new XYSeriesRenderer(); r.setColor(Color.rgb(255, 124, 0)); r.setFillPoints(true);/*from w w w .j a v a 2s. c o m*/ r.setLineWidth(2.5f); r.setDisplayChartValues(true); r.setChartValuesTextSize(xyChartTextSizeValue); renderer.addSeriesRenderer(r); renderer.setAxesColor(Color.WHITE); renderer.setLabelsColor(Color.LTGRAY); renderer.setBackgroundColor(Color.TRANSPARENT); renderer.setTextTypeface("sans_serif", Typeface.BOLD); renderer.setLabelsTextSize(xyLabelsTextSizeValue); renderer.setAxisTitleTextSize(xyAxisTitleTextSizeValue); renderer.setLegendTextSize(xyLegendTextSizeValue); renderer.setXTitle(FunctionUtils.capitalizeFirtsLetter(getString(R.string.minutes))); renderer.setYTitle(getString(R.string.beats)); renderer.setXLabels(20); renderer.setYLabels(20); renderer.setYLabelsAlign(Align.LEFT); renderer.setShowGrid(false); renderer.setXAxisMin((timeList.get(0) / 60)); renderer.setXAxisMax((float) ((float) timeList.get(timeList.size() - 1) / 60)); renderer.setYAxisMin(min_hr); renderer.setYAxisMax(max_hr); return renderer; }