Press menu in the status bar of the flat interface and no response is displayed.

Source: Internet
Author: User

1. Problem description:

In a 4.1 system, the debugging machine is 768*1024
Default: the menu key is displayed in the status bar on the launcher interface, but the menu key is displayed, but no interface is displayed when the menu key is pressed,
But there is no problem with the original machine: 1024*600

1) Find the cause:
Launcher code problems. Compare the same code with different machines to prove that the code is correct.
Resource layout problem: the layout of strong walking 1024*600 proves that the layout is correct.
The only difference between the size of the Code is different. At last, we can only trace the process of pressing the menu key, and finally confirm the reason.

2) confirm the cause:

Key for pressing the menu key:

File:
Phonewindow. Java (frameworks \ base \ Policy \ SRC \ com \ Android \ internal \ Policy \ impl)

Press the key to go to the following two files:

Public final Boolean onkeydownpanel (INT featureid, keyevent event ){
}
Public final void onkeyuppanel (INT featureid, keyevent event ){
...
Openpanel (St, event );
...
}

Private void openpanel (panelfeaturestate St, keyevent event ){
// System. Out. println ("open panel: isopen =" + st. isopen );

// Already open, return
If (St. isopen | isdestroyed ()){
Return;
}

// Don't open an options panel for honeycomb apps on xlarge devices.
// (The app shocould be using an action bar for menu items .)
If (St. featureid = feature_options_panel ){
Context context = getcontext ();
Configuration Config = context. getresources (). getconfiguration ();
Boolean isxlarge = (config. screenlayout & configuration. screenlayout_size_mask) =
Configuration. screenlayout_size_xlarge;
Boolean ishoneycombapp = context.getapplicationinfo().tar getsdkversion> =
Android. OS. Build. version_codes.honeycomb;

If (isxlarge & ishoneycombapp ){
Return;
} // Here is the cause of the problem
}
...
}

3) // problem analysis, with two conditions
Isxlarge and ishoneycombapp
Isxlarge is true:
Boolean isxlarge = (config. screenlayout & configuration. screenlayout_size_mask) =
Configuration. screenlayout_size_xlarge;

Analysis: file: windowmanagerservice. Java (frameworks \ base \ Services \ Java \ com \ Android \ Server \ WM)

Private int performanceconfiglayout (INT curlayout, int rotation, float density, int DW, int DH ){
...
// Configuration. Do not change!
If (longsize <470 ){
// This is shorter than an hvga normal density screen (which
// Is 480 pixels on its long side ).
Screenlayoutsize = configuration. screenlayout_size_small;
Screenlayoutlong = false;
Screenlayoutcompatneeded = false;
} Else {
// What size is this screen?
If (longsize> = 960 & resize size> = 720 ){
// 1.5 xvga or larger screens at medium density are the point
// At which we consider it to be an extra large screen.
Screenlayoutsize = configuration. screenlayout_size_xlarge; // The reason the system is here.
} Else if (longsize> = 640 & Strong size> = 480 ){
// VGA or larger screens at medium density are the point
// At which we consider it to be a large screen.
Screenlayoutsize = configuration. screenlayout_size_large;
} Else {
Screenlayoutsize = configuration. screenlayout_size_normal;
}
...
}

4) solution: block the function and solve the problem. Press the menu key to bring up the following options:
Private void openpanel (panelfeaturestate St, keyevent event ){
If (isxlarge & ishoneycombapp ){
; // Return; // Block
} // Here is the cause of the problem
}

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.