4

I want know it's possible to style text like this:

Text style example

Note : I am using shadow but it doesn't seem useful to me. I would like to get a two color text like in the picture above.

This is my code:

<com.example.fabulous.comic.CustomTXT
    android:textColor="@color/white"
    android:shadowColor="@color/blacke"
    android:layout_margin="2dp"
    android:id="@+id/txt"
    android:text="hellow"
    android:layout_width="match_parent"/>
    android:layout_height="wrap_content"/>
Erfan
  • 3,059
  • 3
  • 22
  • 49

4 Answers4

3

Yes you can create text like this see my previous detail answer here.

Set text color to white and outline color toblack.

Community
  • 1
  • 1
Sohail Zahid
  • 8,099
  • 2
  • 25
  • 41
0

Why don’t you chose a custom font with a custom color? This link might help you to customize your font .

0

Try this

 <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:textColor="@color/white"
android:textSize="20sp"
android:shadowColor="@color/black" 
android:shadowRadius="2"/>

you increase the radius as you want and color as you wish

enter image description here

You Can Also Trying using the Font.....

Used Montserrat.ttp download for google and also you used more fonts.. as you wish

    String fontPath = "fonts/mont.ttf";
    Typeface tf = Typeface.createFromAsset(getAssets(), fontPath);
    btn_reload.setTypeface(tf);
Arjun saini
  • 4,223
  • 3
  • 23
  • 51
0

Using shadows in TextView should do the trick to get an outline effect :

android:shadowColor="#000000"
android:shadowDx="1.5"
android:shadowDy="1.3"
android:shadowRadius="1.6"
android:text="CCC"
android:textAllCaps="true"
android:textColor="@android:color/white"

You can also use a web service like WhatTheFont to find the police used in any picture. I used your picture to find the closest match and got this answer:

WhatTheFont answer

The police is Minutia Outline and you can find it here.

I am not sure this is the solution you were after, but using this police will get you exactly what you have in your picture.

If you prefer to not use fonts, you could simply use some CSS to style your text, webView to use html/css in Android like so:

.strokeme
{
    color: white;
    text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
    font-size: 250%;
}
<div class="strokeme">
    Is this what you were looking for?
</div>
David Gourde
  • 3,709
  • 2
  • 31
  • 65