Android textview 45 ° skew

Source: Internet
Author: User

Recently, because the project needs to use an effect, that is, the display effect of TextView skew. After studying it, I found it very simple and shared it for use.

You can use it. If you have a picture, it's just the truth. First



In the upper-right corner of each item, a diagonal TextView is displayed!

First customize a TextView


Public class JZADScoreTextView extends TextView {public JZADScoreTextView (Context context) {super (context);} public JZADScoreTextView (Context context, AttributeSet attrs) {super (context, attrs );} @ Override protected void onDraw (Canvas canvas) {// slope 45, center between top, bottom, and left. canvas. rotate (45, getMeasuredWidth ()/3, getMeasuredHeight ()/3); super. onDraw (canvas );}}

Yes, it's that simple.

There is a need for source code here to download http://download.csdn.net/detail/lan410812571/5786605

Download source code

Related Article

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.