Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- displayValue = new StringBuilder / TextView / SpannableStringBuilder
- public CustomHeaderView(Context context, AttributeSet attrs) {
- super(context, attrs);
- LayoutInflater.from(context).inflate(R.layout.view_custom_header, this, true);
- setOrientation(VERTICAL);
- int fourDp = context.getResources().getDimensionPixelSize(R.dimen.four_dp);
- setPadding(fourDp, fourDp, fourDp, fourDp);
- setBackgroundColor(Color.WHITE);
- displayValueTV = (TextView) findViewById(R.id.display_value);
- //for holding conversions
- displayValue1Buffer = new StringBuilder();
- displayValueSBuilder = new SpannableStringBuilder();
- ForegroundColorSpan darkGreySpan = new ForegroundColorSpan(context.getResources().getColor(R.color.dark_grey_text));
- StyleSpan boldSpan = new StyleSpan(android.graphics.Typeface.BOLD);
- displayValueSBuilder.append(LITERAL_PREFIX_DISPLAY_VALUE);
- displayValueSBuilder.setSpan(darkGreySpan, 0, LITERAL_PREFIX_DISPLAY_VALUE.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE););
- displayValueSBuilder.setSpan(boldSpan, 0, LITERAL_PREFIX_DISPLAY_VALUE.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE););
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement