area circle minus half the width of the outer contour circle, so that the external contour line and the inner fill circle are close to each other.
Draw a TextView word
For our drawing and textview our own drawing does not overlap, we kill super.ondraw (canvas), so here we have to write the TextView word.
First get TextView's default brush, set the TextView itself font color, anti-aliasing, in order to beautiful we forced the text center:
Reprint
Paint Paint =
Transferred from: http://blog.csdn.net/lizzy115/article/details/7513552FloatOther than that:1) QuestionsWhen you implement an adaptive Tablectrl control in Android to display text information, there is a problem when you need to get the width value of the longest string in a column. After searching the internet, I discovered that Android can take advantage of the Measuretext (Stringtext) method of the paint already provided in the SDK. So try the code that has been given online:Paint paint = new
);canvas.drawCircle(bounds.centerX(), bounds.centerY(), outerRadius - outLineWidth, mPaint);The center is the center of the drawing area, and the radius is the width of the 绘制区域圆 radius minus 外部轮廓圆线 . This just fills the circles and the outer contour circles do not overlap.Draw an outer border circleThis is simple because it is a hollow line, so Style Yes STROKE , then set the width of the line, the color of the brush:2, mPaint);The center of the Circle is the center of the drawing area, and the
Objective
Before writing an article on the effect of TextView, then the actual project has found new problems, such as still can not run automatically, text over the display area on the interception of the problem, today changed a way of thinking to achieve, simpler and better use.
Body
Code implementation:
public class Marqueetextview extends TextView {/** Stop scrolling */private Boolean mstopmarquee;
Private String Mtext;
private float Mcoordinatex;
private float mtextwidth;
public class Drawabletoplefttextview extends TextView {private Paint mpaint;private float ffontheight;private drawable[] drawables;private int leftMargin = 40; TODO this to get through code, cannot hard code public Drawabletoplefttextview (context context, AttributeSet attrs, int defstyle) {Super (context , Attrs, Defstyle); init ();} Public Drawabletoplefttextview (context context, AttributeSet Attrs) {Super (context, attrs); init ();} Public Drawabletoplefttextview (Context context) {super (co
it with the Getdrawable method. The method used here and Baidu common to the method is slightly different, because Baidu on the method in my here will have a bug, in the second entry when the picture is often not loaded out.First, write a class that inherits Bitmapdrawable, with the following code:Package Com.githang.gradledoc.chapter;import Android.graphics.bitmap;import Android.graphics.canvas;import android.graphics.drawable.bitmapdrawable;/** * User:geek_soledad ([email protected]) * date:2
Listview selects the last item by default.Android: stackfrombottom = "true" Android: transcriptmode = "alwaysscroll"Android Chinese boldAndroid: FIG = "#000000"Android: shadowdx = "0.2" Android: shadowdy = "0.0" Android: shadowradius = "0.2"Android: textstyle = "bold" can be used in XML files to set English to bold, but Chinese cannot be set to bold,The method for setting Chinese characters to bold is textview TV = (textview) findviewbyid (R. Id. textview01 );Textpaint TP = TV.
); } public VerticalTextView(Context context, AttributeSet attrs) { super(context, attrs); } public VerticalTextView(Context context) { super(context); } @Override protected void onDraw(Canvas canvas) { final ColorStateList csl = getTextColors(); final int color = csl.getDefaultColor(); final int paddingBottom = getPaddingBottom(); final int paddingTop = getPaddingTop(); final int viewWidth = getWidth(); final int v
mViewWidth = getMeasuredWidth () will be entered; // obtain the current width if (mViewWidth> 0) {mPaint = getPaint (); // obtain the Paint object of the currently drawn textview. ** set a LinearGradient Renderer. * The first two parameters are the starting point for setting the gradient, here, the upper left corner of the rectangle is set as the starting point * The third four parameters are set as the ending point of the gradient. Here, the upper r
The Android custom TextView drawableTop icon is left aligned with the text (), and textview is left aligned
Public class DrawableTopLeftTextView extends TextView {private Paint mPaint; private float fFontHeight; private Drawable [] drawables; private int leftMargin = 40; // The TODO object must be obtained through code, public DrawableTopLeftTextView (Context context, AttributeSet attrs, int defStyle) {super (context, attrs, defStyle); init ();} public DrawableTopLeftTextView (Context context, A
1. No animation is required to start the program.Java code
Myintent. setflags (intent. flag_activity_no_animation); // 1.5 should be used, so that no animation effect can be obtained.
Getwindow (). setwindowanimations (1) // 1.6 should be used. Do not forget to put it in Activity
2. Create a directory for the SD cardJava code
File wallpaperdirectory = new file ("/sdcard/wallpaper /");
Wallpaperdirectory. mkdirs ();
File outputfile = new file (wallpaperdirectory, filename );
Fileoutputs
,
The conversion efficiency of Android dateformat classes is much higher than that of Java.
Question 2: How to Reduce the layout layers of itemview in listview
I have already written this article. As mentioned in my previous blog, although using the merge label as the top-level label can reduce the level of view, all the attributes set in the merge label will not work, you need to set it in the code.
Question 3: Set the bold format for Chinese Characters
Mpublisher
=
(Textview)
Because a new project requires a font and underline effect, the visual effect can be forged through images. However, in order to reflect the technical content, I want to use textview to underline the effect. There are two methods. The first one isMtxtregister. getpaint (). setflags (paint. underline_text_flag);The second type isMtxtregister. settext (html. fromhtml ("After comprehensive comparison, it is found that the first method is ineffective, and
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.