Is there a way I can have gradient drawable for my rating view I am OK with if I need to draw those "ZZZZZ" in onDraw method instead of defining in xml because they need to be smaller to larger. So instead of extending RatingBar class I tried extending textview class and planning to use onTouch (Move) event to get the rating from 1-5. Correct me if you think extending RatingBar class would be still better idea. So far I was able to get different text size by using -
for (int i = 0; i < text.length(); i++) {
SpannableStringBuilder sb;
fontSize += incrementFontBy;
paint.setTextSize(fontSize);
setTypeface(typeFace);
sb.setSpan(new AbsoluteSizeSpan(fontSize), i, character.length, 0);
setText(sb);
}
Also, I am not sure if spannable gradient is possible as I move my finger but I know I can have gradient using paint object. For testing purpose I did -
paint.setShader(new LinearGradient(0,0,0,getPaint().getTextSize()/2,Color.BLACK,Color.GREEN, Shader.TileMode.CLAMP));
I haven't implemented onTouch event yet. But I am trying to find all my possibilities before I get into onTouch event. Things that I am seeking for
- Can spannable text have gradient(looking at Dynamic Spannable currently)
- Can Rating view have custom drawing (drawing that is small to large and gradient on touch
Expectation
Result so far