Android custom View combination control ---- LED digital clock
First
LEDView effect.
Previously, I saw a blog using two textviews to achieve this effect. So I want to use a custom control to implement an LEDView, which can be used directly.
The combination of controls, the two textviews stacked together, and then use the digital-7.ttf font to display data, so as to achieve the LED effect. The Code is as follows:
LEDView. class
Package ione. zy. demo; import java. io. file; import java. util. c
fill_or_strokeSetxfermode (Xfermode xfermode);Sets the way in which graphics overlap, such as merging, intersection, or union, often used to create eraser effects2. Text renderingSetfakeboldtext (Boolean fakeboldtext);Simulation to implement bold text, set in small font effect will be very poorSetsubpixeltext (Boolean subpixeltext);Setting this to True will help the text appear on the LCD screenSetTextAlign (Paint.align Align);Set the alignment direction of the drawing textSettextscalex (float
during painting, such as smooth effects.
SetStrokeWidth (float width );
When the paint brush style is STROKE or FILL_OR_STROKE, set the width of the paint brush.
SetXfermode (Xfermode xfermode );
Sets the processing method when the image overlaps, such as merging, intersection or union, which is often used to make the eraser erasure effect.2. Text Rendering
SetFakeBoldText (boolean fakeBoldText );
Simulate the implementation of bold text, the effect on small font will be very poor
SetSubpixelTe
/17148535
11. Fonts Font Library:
Arimo Font:
Http://www.fontsquirrel.com/fonts/arimo/fonts/arimo
Https://www.google.com/fonts#UsePlace:use/Collection:Arimo
The Chinese font library is generally otf, directly changed to ttf can be used, Demo is as follows: Self: http://www.eoeandroid.com/thread-163834-1-1.html
Public class Y_fonts extends Activity {/** Called when the activity is first created. * // @ Override public void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState)
This example mainly uses the font, but android comes with only a few types. Although android provides the font reprinting function, I tried it and did not find it successful, so I didn't get it in the code, so I got it. Try again tomorrow and find that the book code is not very suitable for android. When the font size increases, there will be a bug that only two lines can be entered. I will revise this bug later
Below is:
MainView code:
Java code
Package com. wjh. demon_5;
Import android. co
When doing Android development, some software will require some special fonts, we need to introduce the external TTF format font into the program, the specific steps are:Create a new fonts directory in the Android app directory assets, copy the TTF font file we need to use (the OTF format directly changes the suffix to TTF), then the code:// Save the font file in the assets/fonts/directory, in program Typeface
comparison can explain the problem.You can see the serif on the default font, adding a liner. The nonospace limits the width of each character, allowing them to achieve an equal-width effect.The equal width in fact very good understanding, what is the liner exactly mean? Here is a picture of Wikipedia that gives you a visual explanation of the problem.Liner is actually the font edge of that little tweet.3.3 android:fontfamilyfontFamilyIt looks like it's right
new technology, but it has existed and been in use for many years. sIFR is a useful and handy text replacement technology that embeds network fonts into the page by FLASH+JS+CSS.
Considering the internet has a lot of resources, this article will not repeat, want to know friends can refer to the article:
How and when to use SIFR
sifr-Text Replacement Technology
sifr--Baidu Encyclopedia
Typeface.js
Typeface is considered to be the best alternativ
Font is the appearance of text display and printing, it includes the characters of words, style and size, and many other attributes. Appropriate choice of different fonts, can greatly enrich the external expression of the text. For example, some important words in the text with a thicker font display, can reflect the prominent, emphasis of the intention. Of course, text output can also use its formatting properties and display quality to optimize the effect of text display.
Font properties and
separatord7b Delete to the beginning of the first 7 words with spaces as separatorsD4) Delete to the end of the fourth statementD (Delete to the beginning of a statementd) Delete to the end of a statementd{Delete to the beginning of a paragraphnd{the nth paragraph position before the start position of the current paragraph is deletedD/text deletes the position of the typeface specified in the text from "text", moving forward until the next occurrence
One, custom fonts1.android typeface setting fonts using TTF font filesWe can put the TTF font file in the program and use typeface to set the font in the program.The first step is to create a new fonts directory under the assets directory and place the TTF font file here.In the second step, the program calls:?
1234567
AssetManager mgr=getAssets();//得到AssetManagerTypeface tf=Typeface.cre
Swift provides three ways to compare text values: String characters typeface, prefixes equal, and suffixes equal.string/character typeface (string and Character equality)The string/character can be used as the Equals operator ( == ) and not equal to the operator ( != ), described in detail in the comparison operator:Let quotation = "We ' re a lot alike, you and I." Let samequotation = "We ' re a lot alike,
effect of the text stretching * * Settextsize (float textSize); * Set the font size of the drawn text * * SETTEXTSKEWX (float skewx); * Set italic text, skewx for oblique radian * * Settypeface (Typeface Typeface); * Set typeface object, that is, font style, including bold, italic and liner body, non-liner body, etc. * Setunderlinetext (Boolean
1. Download the font file, the only thing you need is the. ttf file2. Create a new directory under the App→src→main of the project, named assets3. Place the. ttf file in the assets4. In Mainactivity.java, change the following code to add1 @Override2 protected voidonCreate (Bundle savedinstancestate) {3 Super. OnCreate (savedinstancestate);4 Setcontentview (r.layout.activity_main);5String Customfont = "Chinese instrument nangong-body Simple TTF";6Typeface
The most important task of a designer is to design beautiful page elements, such as logo design. To design good things, you need good resources. I found that designers around me design a logo, it usually takes half a day or even one day. The key factor is that the materials are not ideal and the final product design is not good. Today I have collected some new free and high-quality fonts, which are not only nice-looking, it can also be used in any design project..All fonts in this collection can
There are three types of fonts: 1, built-in basic font 2, the creation of new typeface 3 through basic fonts and styles, and the introduction of external TTF files.The sample code is as follows:1. Package com.mike.activity;2.3. Import Android. R4. Import android.app.Activity;5. Import Android.graphics.Bitmap;6. Import Android.graphics.Canvas;7. Import Android.graphics.Color;8. Import Android.graphics.Paint;9. Import Android.graphics.Typeface;. import
rectangle with a height or a very small width, which may not be what you want.
Public voidTranslate(Float dx, float Dy)
Note: Translation (x, y) pixel units on the current Coordinate
If dx is
If dy is
Public voidRotate(Float degrees)
Note: rotate the image to a certain angle.
PS: from the above, the image is indeed rotated, but I cannot find the rotation center.
The demo is provided below. You can change the number of shards and then observe the effect.
1. layout file main. xkl:Worker u
encapsulation that displays text by a text sprite class (text. And encapsulate the responsibility of generating text bitmap and converting it to texture, and integrate a fontres class. The string to be displayed is segmented into a single character. bitmap is generated through the canvas and cached, and then merged when the texture is bound, the advantage of this is that the performance is very high when repeated characters are displayed. Load music and sound effects Resources in the onloadreso
and 3D space models.
Pretty date
A very good JavaScript library shows the date in a very nice and friendly way, as shown in
Xregexp
The javascript Regexp object already supports regular expressions. xregexp adds more future browser inclusion functions (ecmascript 4-ES4). This library caches and reuses Regexp objects and adds many new functions.
Javascript URL Library
A JavaScript library used to process any part of the URL
6. Fonts
Typeface. j
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.