Reputation: 5152
I am wordering that, how can I assign multiple colors on single character as shown below:
This is the character of urdu language.
R&D: Found that I can assign multiple colors on different characters in string, but unable to apply different color patterns on single character.
Upvotes: 2
Views: 430
Reputation: 5152
Posting solution for others help!
Xml layout Code:
<TextView
android:id="@+id/tvPatternCharacter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ب"
android:textSize="370sp"
android:textColor="#000000"/>
Activity code:
TextView tvPatternCharacter=(TextView)findViewById(R.id.tvPatternCharacter);
tvPatternCharacter.setText("ب");
Bitmap bitmap
= BitmapFactory.decodeResource(
getResources(),
R.drawable.pattern);
Shader shader = new BitmapShader(
bitmap,
Shader.TileMode.CLAMP,
Shader.TileMode.CLAMP);
tvPatternCharacter.getPaint().setShader(shader);
Thanks for the link aelimill, text pattern
Upvotes: 1