Mobile phone audio and video 12-display lyrics, audio and video 12-display lyrics

Source: Internet
Author: User

Mobile phone audio and video 12-display lyrics, audio and video 12-display lyrics
1 _ create LyricShow

1 _ create LyricShow: text size, anti-aliasing, center alignment

Public class LyricShow extends TextView {private ArrayList <Lyric> lyrics;/*** Paint brush */private Paint currentPaint; private Paint noCurrentPaint; // call back the public LyricShow (Context context, AttributeSet attrs) {super (context, attrs) when instantiating the layout file ); // TODO Auto-generated constructor stub initView () ;}@ Override protected void onSizeChanged (int w, int h, int oldw, int oldh) {// TODO Auto-generated method stub super. onSizeChanged (w, h, oldw, oldh); width = w; height = h;} private void initView () {currentPaint = new Paint (); // you can set the anti-aliasing currentPaint. setAntiAlias (true); // sets the color currentPaint. setColor (Color. GREEN); // set the text size currentPaint. setTextSize (16); // set the alignment currentPaint. setTextAlign (Paint. align. CENTER); noCurrentPaint = new Paint (); // you can specify noCurrentPaint. setAntiAlias (true); // set the noCurrentPaint color. setColor (Color. WHITE); // set the text size noCurrentPaint. setTextSize (16); // set alignment noCurrentPaint. setTextAlign (Paint. align. CENTER) ;}@ Override protected void onDraw (Canvas canvas) {// super. onDraw (canvas); canvas. drawText ("no lyrics found", width/2, height/2, currentPaint );}}

2 _ draw the lyrics-current sentence-Prefix-last sentence

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.