If you've ever encountered a developer setting on Xiaomi smartphones or tried to adapt an app to the MIUI ecosystem, you've noticed a mysterious parameter called "DP minimum width." This acronym plays a key role in how the system scales the interface to different screen sizes. But what does it mean in practice? Why is this parameter isolated in Xiaomi, and how does its change affect the display of elements?
In this article, we will not only look at the theoretical side of the issue, but also look at real-world application scenarios, from customizing the interface to solving application compatibility problems. You will learn how the minimum width of DP is related to pixel density (DPI), why changing it can โbreakโ the display of some programs, and what values are considered optimal for different models of Xiaomi, Redmi or POCO. And also โ where to find this parameter in the settings and how to adjust it correctly without risking the stability of the system.
What is DP (density-independent pixels) and why is it important?
DP (or dp) was introduced in Android as a response to the problem of adapting interfaces to screens with different pixel density. Unlike physical pixels, one DP is always 1/160 inches, regardless of screen resolution, which allows developers to set the sizes of elements (buttons, text, indentations) in DP, and the system automatically converts them into real pixels, taking into account the DPI of the device.
For example, if a screen with a density of 160 DPI (mdpi) 100dp will equal 100px, then on a screen with 320 DPI (hdpi) the same 100dp will turn into 200px.
- ๐ DP vs PX: DP โ unit, PX โ The system itself calculates the ratio from the physical pixel. DPI.
- ๐ Scaling: When changing the minimum width DP The system compulsorily recalculates the dimensions of all interface elements.
- โ๏ธ System parameter: B MIUI This parameter is hidden in the developer settings and affects swdp (smallest width in). DP).
But why does Xiaomi set the minimum width? Because it determines how the system will โthinkโ about screen size when selecting resources (mockups, images) to display. For example, if the minimum width is set at 360dp, then MIUI will use resources designed for devices with a screen not already 360dp, even if the physical screen is wider.
Where in Xiaomi to find the setting of the minimum width of DP
By default, the minimum width DP is hidden from the user, as changing it can lead to an incorrect display of the interface. To access it, you first need to activate the developer mode:
- Go to Settings. โ The phone.
- Find the MIUI version and tap it 7 times in a row (you will receive a notification โYou became a developerโ).
- Return to the main settings menu and open the section Additional โ For developers.
- Scroll down to the Drawing block and find the Minimum Width option (in DP).
Depending on the MIUI version and the smartphone model, the path may vary slightly, for example, on some POCO devices, the Developer For Devices section is called Advanced Settings โ Developer Mode.
adb shell settings put global forced_display_size 360x720(where 360 is the desired minimum width in DP).-->
Important: Changing this setting is not officially supported and may cause some applications to crash, especially if they are not optimized for non-standard DP values.
Optimal minimum DP widths for different Xiaomi models
Incorrectly selected minimum width DP It can make the interface either too small (inconvenient to read) or too large (elements do not fit on the screen). POCO:
| Model of the device | Screen resolution | Density (DPI) | Recommended minimum width (DP) | Notes |
|---|---|---|---|---|
| Xiaomi 13/13 Pro | 2400ร1080 | 410 DPI | 390โ410 | Values above 410 may cause elements to be trimmed in some games. |
| Redmi Note 12 Pro+ | 2400ร1080 | 390 DPI | 360โ380 | Optimal for the balance between readability and interface density. |
| POCO F5 | 2400ร1080 | 400 DPI | 380โ400 | Values below 360 can distort the display in the Google Play Store. |
| Xiaomi Pad 6 | 2880ร1800 | 308 DPI | 600โ640 | For tablets, higher values are recommended for the correct display of applications. |
These are recommendatory values, for example, if you want to zoom in for ease of reading, you can reduce the minimum width of DP by 20 to 30 units from the standard value, but don't go beyond the range of 320 to 640 DP, as this can lead to critical display errors.
Consequences of changing the minimum width of DP: pros and cons
Changing the minimum width of DP can both improve user experience and create problems.
- โ Improved readability: Decreased DP Increases the size of text and interface elements, which is useful for users with vision problems.
- โ Adaptation to tablet mode: On smartphones with large screens (for example, Xiaomi Mix Fold) increase DP It allows you to use the space better.
- โ Distortion of layouts: Some applications (especially banking or games) may not display correctly if their design does not provide non-standard designs. DP.
- โ Multi-window problems: On devices with MIUI 14+ change DP It can break the split screen mode.
โ ๏ธ Note: Applications that use WebView (such as some messengers or browsers) may display content incorrectly when changed. DP. This is because WebView does not always correctly process non-standard swdp values.
One of the most notable effects is the change in the display in the Google Play Store. DP (For example, 320) the store can show a version of the interface for tablets, even if you use a smartphone.+) Some elements may be cut off.
How to return standard DP settings if the interface is broken?
How Minimum DP Wideness Affects MIUI Application Development
For Xiaomi app developers, understanding the minimum width of DP is critical, because MIUI uses this parameter to determine the category of screen size on which the choice of resources (mockups, images, styles) depends.
- ๐ฑ swdp < 600: The system considers the device a smartphone and downloads resources from the folder values-sw360dp or layout-sw360dp.
- ๐บ swdp โฅ 600: The device is classified as a tablet and resources from values-sw600dp.
- ๐ฅ๏ธ swdp โฅ 720: Large screen mode activates (e.g., Xiaomi Pad 6 Pro or foldable devices).
If your app doesnโt take these categories into account, it may not display correctly on devices with a changed minimum DP width. For example, if a user manually set swdp=500 on a tablet, but your app doesnโt have layouts for sw500dp, the system will use resources for smartphones, which will lead to stretching or trimming elements.
To avoid such problems, it is recommended:
- Test the application on devices with different DP values (you can use emulators with swdp setting).
- Add alternative layouts for popular values (sw360dp, sw411dp, sw600dp).
- Use ConstraintLayout and PercentRelativeLayout for flexible adaptation to different sizes.
Testing on an emulator with swdp = 360
Testing on an emulator with swdp=600
Checking the display of dialog windows
Checking font scaling
-->
Frequent Mistakes When Working with Minimum DP Wideness and How to Avoid Them
Many users and even developers make mistakes when working with a minimum DP width, and here are the most common ones and ways to solve them:
| Mistake. | Effects of consequences | Decision |
|---|---|---|
| Set the DP value below 320 | Distortion of system dialogues, errors in the Google Play Market | Use values not lower than 360 DP for smartphones |
| Change DP without rebooting | Interface elements are displayed incorrectly before restarting | Always restart your device after changing DP |
| Using DP to scale fonts | Text becomes too large or small in some applications | For fonts, use a separate font size setting in Settings โ Screen |
Another common problem is the conflict with the screen density settings (DPI), where some users try to change both the DPI and the minimum width of the DP at the same time, which leads to unpredictable results, for example, if you reduce the DPI to 320, but leave the minimum width of the DP at 410, the system will use resources for large screens, but display them in a "compressed" form, which will lead to the overlay of elements.
โ ๏ธ Attention: On devices with MIUI 13 and newest change in minimum width DP If the gestures stop working correctly after the parameter change, return the standard value. DP Or reset the gesture settings in the Settings โ System system โ Gestures.
Practical scenarios: when and why to change the minimum width of the DP
While changing the minimum width of DP is not recommended for everyday use, there are a few scenarios where it can be helpful:
- ๐ Adaptation for the visually impaired: Reducing DP Increases the size of interface elements, which facilitates interaction with the device.
- ๐ฎ Game mode: Some games (e.g. Genshin Impact or PUBG Mobile) is better displayed at certain values DP, Especially on devices with non-standard aspect ratios.
- ๐ฑ Application testing: Developers need to check how their application behaves at different swdp values.
- ๐ฅ๏ธ Tablet Emulation: On smartphones with large screens (for example, Xiaomi Max 3) you can turn on the tablet mode by installing swdp=600.
Example: If you use the Xiaomi Pad 5 in smartphone mode (with a minimum width of DP 360), some applications (such as Telegram or VK) will display the mobile version of the interface. By setting swdp=600, you will force them to switch to multi-column tablet mode.
However, before changing the DP, it is worth considering several nuances:
๐ก
Changing the minimum width of DP is not a universal scaling solution; some applications (e.g. banking) may need to return standard settings to work properly.