Compared with Windows Phone 7, Windows Phone 8 has many features and performance improvements, such as multi-core cup, SD card, multiple resolutions, and obviously WP7 WVGA-480x800 cannot meet all requirements. user requirements, many users prefer large-screen high-resolution mobile phones. With the gradual launch of large-screen mobile phones, WP8 also supports large-resolution screens [wxga-768x1280 and 720 p-720x1280]
I have mentioned to you about the application configuration and WP8 resolution, however, some people may not quite understand how to determine the resolution of the current mobile phone and how to make the app adapt to the resolution of the current mobile phone. I will give you a detailed introduction today.
Windows Phone 8 supports three screen resolutions:
We can clearly see that the screen width ratio of WVGA and wxga is, only 720 p is. This reminds you that some applications may have to deal with P, for example, some image or video applications.
In addition, I believe many people want to achieve full screen or change the color of the system time power icon, please use systemtray to set:
Void Mainpage_loaded ( Object Sender, routedeventargs e) {progressindicator progress = New Progressindicator {isvisible = True , Isindeterminate = True , Text = " Downloading details... " }; Systemtray. setprogressindicator ( This , Progress); systemtray. backgroundcolor =System. Windows. Media. colors. Red; systemtray. foregroundcolor = System. Windows. Media. colors. blue; // Systemtray. isvisible = false; }
The above method can hide the status bar or adjust the Tray Style Based on the Application style. I personally think it is more practical to introduce it here.
Of course, today's focus is on multi-resolution support. The following is a resolutionheper class method to determine the current screen resolution:
Public Enum Resolutions {WVGA, wxga, hd720p }; Public Static Class Resolutionhelper { Private Static Bool Iswvga { Get { Return App. Current. Host. content. scalefactor = 100 ;}} Private Static Bool Iswxga { Get { Return App. Current. Host. content. scalefactor = 160 ;}} Private Static Bool Is720p { Get { Return App. Current. Host. content. scalefactor = 150 ;}} Public Static Resolutions currentresolution { Get { If (Iswvga) Return Resolutions. WVGA; Else If (Iswxga) Return Resolutions. wxga; Else If (Is720p) Return Resolutions. hd720p; Else Throw New Invalidoperationexception ( " Unknown resolution " );}}}
The above sectionCodeIn system. Windows. InterOP
Public IntScalefactor {Get;}
The Scale Factor for the current application content area.
Determine the screen resolution by screen ratio.
In addition, the corresponding splashscreenimage.jpg file is used on different mobile phones to perfectly adapt to the screen size. Otherwise, the system will automatically zoom in and out.
See msdn: http://msdn.microsoft.com/en-us/library/windows/apps/ff769511 (V = vs.105). aspx
In addition, the XAML control must be adaptive to the mobile phones with different resolutions. When setting the width of the control, do not use the absolute height or width. Use the ratio values such as "*", "Auto", and "80 *"..
Msdn has a Demo code to do more clearly interested in students can copy their own try very interesting: http://msdn.microsoft.com/en-us/library/windows/apps/jj206974 (V = vs.105). aspx
The above are some tips for getting and setting the WP mobile phone layout,You are welcome to communicate with me here or on Sina Weibo.@ Wang Bo _ Nick