Android Application Form display status operation (Application of requestWindowFeature)

Source: Internet
Author: User

During development, full screen display, custom titles (using buttons and other controls), and other requirements are often required. Today we will talk about how to control the form display of Android applications. first, we will introduce an important method: requestWindowFeature (featrueId). Its function is to enable extended form features. A parameter is a constant defined in the Window class. 1. The enumerated constant FEATURE_OPTIONS_PANEL = 0; the function is unknown. For more information, see the following description (default enabling) FEATURE_NO_TITLE = 1; no title bar FEATURE_PROGRESS = 2; display the loading progress on the title bar, for example, when webview loads a webpage (Bar progress bar) FEATURE_LEFT_ICON = 3; FEATURE_RIGHT_ICON = 4 is displayed on the left of the title bar; FEATURE_INDETERMINATE_PROGRESS = 5 is displayed on the right of the title bar; uncertain progress (circle-like wait icon) FEATURE_CONTEXT_MENU = 6; context menu, equivalent to right-click menu on PC (default enabled) FEATURE_CUSTOM_TITLE = 7; custom title bar, FEATURE_OPENGL = 8 cannot be used with other title bar attributes. If OpenGL is enabled GL processing (the 2D in OpenGL is a subset of 3D) Progress =-1; The progress bar is visible PROGRESS_VISIBILITY_OFF =-2; The progress bar is invisible PROGRESS_INDETERMINATE_ON =-3; the uncertain mode is enabled PROGRESS_INDETERMINATE_OFF; disable the uncertain mode PROGRESS_START = 0; the minimum value of the First progress bar PROGRESS_END = 10000; the maximum value of the First progress bar PROGRESS_SECONDARY_START = 20000; the minimum value of the Second progress bar PROGRESS_SECONDARY_END = 30000 * description: FEATURE_OPTIONS_PANEL indicates that when a user selects a menu, the window calls the onOptionsItemSelected function to process menu functions. Yes. If the FEATURE_OPTIONS_PANEL option is not available, the menu will not respond? I have never tried it, and I cannot find it online. Note that requestWindowFeature must be called before setContentView (). The following three methods are used: getWindow (). setFeatureInt (int featureId, int value) for example: getWindow (). setFeatureInt (Window. FEATURE_CUSTOM_TITLE, R. layout. custom_title_1); this is to set windows custom title getWindow (). setFeatureDrawable (int featureId, Drawable drawable) for example: getWindow (). setFeatureDrawableResource (Window. FEATURE_LEFT_ICON, android. r. drawable. ic_dialog_alert); this is to set the windows custom icon getWindow (). setFlags (int flags, int mask) for example: getWindow (). setFlags (WindowManager. layoutParams. FLAG_FULLSCREEN, WindowManager. layoutParams. FLAG_FULLSCREEN); this is to set windows full screen

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.