Reputation: 366
I would like to add a border independently around each letter of my Textview
like this example :
Actually I have a basic TextView
in purple , but I would like to add yellow border as you can see on this image.
Here is my actual XML
of my Textview
which is the same as the picture but WITHOUT yellow border around letters :
<TextView
android:id="@+id/Coins"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="9dp"
android:layout_marginStart="150dp"
android:layout_marginTop="116dp"
android:fontFamily="@font/montserratbold"
android:textColor="#a51ebf"
android:textSize="20dp"
app:layout_constraintBottom_toBottomOf="@+id/box"
app:layout_constraintEnd_toEndOf="@+id/box"
app:layout_constraintHorizontal_bias="0.55"
app:layout_constraintStart_toStartOf="@+id/box"
app:layout_constraintTop_toTopOf="@+id/box"
app:layout_constraintVertical_bias="0.25" />
I tried many solutions but nothing work especially , let me know if you have something. Thanks !
Upvotes: 2
Views: 1507
Reputation: 366
I "solved" it by adding another Textview at the same position in yellow color and with stroke like this :
TextView textViewShadow = (TextView) findViewById(R.id.textViewShadowId);
textViewShadow.getPaint().setStrokeWidth(5);
textViewShadow.getPaint().setStyle(Paint.Style.STROKE);
What do you think ? It is bad for the application ?
EDIT : I Created a custom Textview , now it works you can see the answer here : Android textview outline text
Upvotes: 1