Text over bitmap with some functionality like text color and size change over bitmap.Please give me any suggestion to do or any github reference link
Asked
Active
Viewed 3,028 times
1
-
1Did you try implementing it yourself? Please post the code that is not working for you. Otherwise, please look for a tutorial, StackOverflow is not a tutorial site :-) – Kelevandos Dec 02 '16 at 08:19
-
And it's also not a code-request site. – Phantômaxx Dec 02 '16 at 09:54
-
@Kelevandos no.I am not trying yet.i didnt get basic idea to do.its not a tutorial site.Thank you.if you know any tutorial link please post it. – Lavanya Velusamy Dec 02 '16 at 11:16
2 Answers
2
I have done such work on one of my application. I have shared code over here...
You have to replace TextView with ImageView used in my code.
Let me know if you stuck somewhere...
Happy Coding :)
-
Thank you.But i need those add text over image like writing a text over an image including a option to change size of text and its color. – Lavanya Velusamy Dec 02 '16 at 11:19
-
Yes, you can that as well. by doing some of the changes in my code. I have done with text in my app. – RBK Dec 02 '16 at 12:35
-
-
use auto resize textview,... something like https://github.com/grantland/android-autofittextview – RBK Jul 03 '17 at 11:33
0
Use SlopeTextView instead of normal text view. Try this:
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.Gravity;
import android.widget.TextView;
public class SlopeTextView extends TextView{
final boolean topDown;
public SlopeTextView(Context context, AttributeSet attrs){
super(context, attrs);
final int gravity = getGravity();
if(Gravity.isVertical(gravity) && (gravity&Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {
setGravity((gravity&Gravity.HORIZONTAL_GRAVITY_MASK) | Gravity.TOP);
topDown = false;
}else
topDown = true;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
super.onMeasure(heightMeasureSpec, widthMeasureSpec);
setMeasuredDimension(getMeasuredHeight(), getMeasuredWidth());
}
@Override
protected boolean setFrame(int l, int t, int r, int b){
return super.setFrame(l, t, l+(b-t), t+(r-l));
}
@Override
public void draw(Canvas canvas){
Paint paint = new Paint();
paint.setTypeface(Typeface.DEFAULT);
paint.setStyle(Paint.Style.FILL);
canvas.rotate(-45,getHeight(),0);
super.onDraw(canvas);
}
}
Implementation:
<com.example.myviews.SlopeTextView
android:id="@+id/slopeTextView"
android:layout_width="60dp"
android:layout_height="70dp"
android:layout_marginTop="5dp"
android:gravity="left|top"
android:text="Featured"
android:textColor="@color/white"
android:textSize="@dimen/text_medium" />

mohitum
- 936
- 2
- 12
- 26