Solved the full screen problem of phonegap on Android phones.

Source: Internet
Author: User

Currently, using HTML5 + JavaScript + css3 with the phonegap framework to develop apps and games on Android or IOS systems has become a possibility. In the past two days, I have developed a small leisurely game using HTML5, using phonegap to package it into an APK and run it on an Android phone, but it cannot be full screen. After thinking for a long time, the solution will be solved...

At the beginning, I had always guessed that it was a problem with the android activity configuration. So I went to the android activity full-screen configuration method and the result still failed.

The configuration code in activity is:

 

this.requestWindowFeature(Window.FEATURE_NO_TITLE);this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

 

When you see that the view activity is inheritedDroidgapm, Instead of activity, I suddenly realized that, alas, it's really B !!! Haha, brother is also the first contact with phonegap, hope to understand...

Paste the Code directly:

/*** File name: noteactivity. java * Creator: Li hangjie * creation date: 01:39:21 */public class noteactivity extends droidgap {/** called when the activity is first created. * // @ override public void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setfullscreen (); super. loadurl ("file: // android_asset/web/app.html");}/*** full screen (no title bar or status bar) */Public void setfullscreen () {getwindow (). clearflags (windowmanager. layoutparams. flag_force_not_fullscreen); // clear the flag requestwindowfeature (window. feature_no_title); getwindow (). setflags (windowmanager. layoutparams. flag_fullscreen, windowmanager. layoutparams. flag_fullscreen );}}

 

Note: When loading a URL page, you must configure its view form attributes. Therefore, you must put them in the first line.

 

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.