I'm trying to do the following:
For now, I am trying to use NativeAndroid.
However, I can do this with HTML and css.
As you can see, it's something like:
However, if I set background to grey and the text to transparent, the text "disappears" and it's all shown as gray.
This is my try (Native Android):
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ff000000" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffcecece"
android:padding="5dp"
android:text="@string/hello_world"
android:textColor="#00ffffff" />
</RelativeLayout>
However, it's showing the following:
There's text, bu as it is transparent, it's not shown.
So my question is:
Thanks!!
Edit: That blue background must be dynamic and it may be an IMAGE!
Click Picture Tools > Recolor > Set Transparent Color.
Just add a \n to your text. This can be done directly in your layout file, or in a string resource and will cleanly break the text in your TextView to the next line.
you can use Canvas for that:
Bitmap bmOverlay = Bitmap.createBitmap(1200, 1200, Bitmap.Config.ARGB_8888);//bMap.getConfig());
Canvas canvas = new Canvas(bmOverlay);
canvas.drawColor(Color.LTGRAY);
Paint paint = new Paint();
Paint mPaintText = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaintText.setStrokeWidth(3);
mPaintText.setStyle(Paint.Style.FILL_AND_STROKE);
mPaintText.setColor(Color.TRANSPARENT);
mPaintText.setTextSize(50f);
mPaintText.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
canvas.drawText("Your TExt", x, y, mPaintText);
Set the textcolor
as your layout backgound
color like light sky blue..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With