Turn git---Don't rely on "play", good-looking custom TextView translucent-android

Source: Internet
Author: User

Reprint please indicate the source: Wang 亟亟 the way of Daniel P1: nonsense part

Last Friday and did not work so not how to write things, on Monday 5 into a map, yesterday opened food, have time to get two other and then buy a cylinder (home of the cylinder, fish, and other animals have been much better. Times OH) 0.0 otherwise they are big, other fish will be unlucky ... Ha ha

The white-red one.

Michael:

When:

P2: Body

Today, a custom TextView is posted, as follows:

It still looks pretty dazzling, right?
Do you feel like you've done something like gradual behavior and so on?

Here sell a Xiaoguanzi, first introduce how to use, realize and so will say must let you eat whale (lazy person's creation, haha ha)

Grade:

{    compile ‘mallethugo-translucent:translucentlib:1.0.0‘}

EC:

Copy it yourself.

How to use??

<com  .mallethugo  .translucent   android:id= "@+id/main_translucent"  android:layout_wi Dth= "match_parent"  android:layout_height= "Match_ Parent " android:paddingtop=" @dimen/activity_vertical_margin " Android : Text= "@string/translucent"  android:textsize= "85SP" /span> android:textstyle= "bold"  Android:fontfamily=" sans-serif-condensed " app:translucentbackgroundcolor=" #000000 "/>< /code> 

Because it is a custom textview so, some of the properties of TextView can be used, font size AH thickness ah what

The extra tag has only one set of non-font part colors

Let's take a look at how the Activity section operates.

public class Mainactivity extends appcompatactivity {@Override protected void onCreate (Bundle savedinstancestate) { Super. OnCreate(savedinstancestate);Setcontentview (R. Layout. Activity_main);list<fragment> fragments = new Arraylist<> ();Fragments. Add(Fragment. Instantiate(This, Fragment1. Class. GetName()));Fragments. Add(Fragment. Instantiate(This, Fragment2. Class. GetName()));Fragments. Add(Fragment. Instantiate(This, Fragment3. Class. GetName()));Fragments. Add(Fragment. Instantiate(This, Fragment4. Class. GetName()));Fragments. Add(Fragment. Instantiate(This, Fragment5. Class. GetName()));Translucentview translucent = (Translucentview) Findviewbyid (R. ID. Main_translucent);Display display = Getwindowmanager (). Getdefaultdisplay();Point size = new Point ();Display. GetSize(size);int width = size. x;int height = size. Y;Translucent. Setstartpositions(Ten, Math. Round(Height/2));Viewpager Viewpager = (viewpager) Findviewbyid (R. ID. Main_view_pager);Pageradapter pageradapter = new Mypageradapter (super. Getsupportfragmentmanager(), fragments);Viewpager. Setadapter(Pageradapter);}}

The original use of multiple fragment as the font content of the fill and then the effect AH implementation ah are used in the picture.

Most commonly said is "hollow out a few words, and then cover a layer of color, inside with a picture filled is so easy"

Have to say that the original author is really "lazy" can, ha haha.

It's more convenient to use a view to solve it when we're using it ourselves.

This one is relatively brief, after all, Monday, Monday syndrome in .... After two days, you'll have to fill it up.

Turn git---Don't rely on "play", good-looking custom TextView translucent-android

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.