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