Android game Development (i): screen and use of brushes

Source: Internet
Author: User

@authur: Qingdujun April 15, 2015 21:00:03

Mainactivity.java Set Full screen, note: its settings must be before Setcontentview;

 PackageCom.qdj.gameone;ImportCom.qdj.ui.ViewOne;Importandroid.support.v7.app.ActionBarActivity;ImportAndroid.os.Bundle;ImportAndroid.view.Window;ImportAndroid.view.WindowManager; Public classMainactivityextendsactionbaractivity {@Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); /*Note that some flags must was set before the window decoration is created.*/GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLA        G_fullscreen); /*Flag for the ' No title ' feature, turning off the title at the top of the screen.*/requestwindowfeature (Window.feature_no_title); Setcontentview (NewViewone ( This)); }}/*** Chinese (Chinese): * GetWindow (). SetFlags ()--Used to remove the top battery display portion of the interface; * Requestwindowfeature ()--is used to remove the title bar (not the top part of the battery); */

Custom View

 PackageCom.qdj.ui;ImportAndroid.content.Context;ImportAndroid.graphics.Canvas;ImportAndroid.graphics.Color;ImportAndroid.graphics.Paint;ImportAndroid.view.View; Public classViewoneextendsView {PrivatePaint paint =NULL;  PublicViewone (Context context) {Super(context); Paint=NewPaint (); /*setting or clearing the anti_alias_flag bit * antialiasing smooths out the edges of what is being DRAWN.*/Paint.setantialias (true); /*Controls Whether the screen should remain on.*/Setkeepscreenon (true);    Paint.setcolor (color.red); } @Override Public voidOnDraw (canvas canvas) {/*set background color.*/Canvas.drawcolor (Color.Black); Canvas.drawtext ("Android Game Develop", 30, 30, paint); }}

Android game Development (i): screen and use of brushes

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.