Minimum DP width in Xiaomi: technical nuances and practical application

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:

  1. Go to Settings. โ†’ The phone.
  2. Find the MIUI version and tap it 7 times in a row (you will receive a notification โ€œYou became a developerโ€).
  3. Return to the main settings menu and open the section Additional โ†’ For developers.
  4. 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 deviceScreen resolutionDensity (DPI)Recommended minimum width (DP)Notes
Xiaomi 13/13 Pro2400ร—1080410 DPI390โ€“410Values above 410 may cause elements to be trimmed in some games.
Redmi Note 12 Pro+2400ร—1080390 DPI360โ€“380Optimal for the balance between readability and interface density.
POCO F52400ร—1080400 DPI380โ€“400Values below 360 can distort the display in the Google Play Store.
Xiaomi Pad 62880ร—1800308 DPI600โ€“640For 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.

๐Ÿ“Š What is the minimum width? DP You are using your Xiaomi?
Default value
360 DP (for compactness)
400+ DP (for details)
I'm experimenting with different meanings.

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?
If, after the minimum width has been changed, DP The interface is not displayed correctly, follow the following steps: 1. DP to standard (usually 360, 390 or 410 depending on the model). 2. Reboot the device. 3. If the problem persists, clear the Settings app cache (Settings) โ†’ Annexes โ†’ Application management โ†’ Settings โ†’ Clear the cache). 4. In extreme cases, reset the settings through Settings. โ†’ Additionally. โ†’ Resetting settings โ†’ Reset the interface settings.

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:

  1. Test the application on devices with different DP values (you can use emulators with swdp setting).
  2. Add alternative layouts for popular values (sw360dp, sw411dp, sw600dp).
  3. 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 consequencesDecision
Set the DP value below 320Distortion of system dialogues, errors in the Google Play MarketUse values not lower than 360 DP for smartphones
Change DP without rebootingInterface elements are displayed incorrectly before restartingAlways restart your device after changing DP
Using DP to scale fontsText becomes too large or small in some applicationsFor 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.

FAQ: Answers to Frequent Questions About Xiaomiโ€™s Minimum DP Wideness

Can I change the minimum width of DP without root rights?
Yes, most Xiaomi devices have this option available in the developer settings without the need for root permissions. MIUI It can be blocked for the global market, and it will need to be used. ADB-team.
Why did some apps look โ€œbrokenโ€ after the DP change?
This is because apps are optimized for standard swdp values. If you set an atypical value (e.g. 500 DP on a smartphone), layouts may not fit the new size, leading to overlapping elements or empty spaces.
How do you know the current minimum DP width on your device?
There are several ways: View in the developer settings (Minimum width (in) DP)). Use applications such as Device Info or AIDA64, where the screen section specifies the Smallest Screen Width (swdp) setting. ADB-command: adb shell wm size (introduces the current screen sizes to the DP).
Does the minimum DP width affect performance?
No, changing this setting does not affect the performance of the device, since it only affects visual zoom, but incorrect values can lead to additional load on the GPU when redrawing the interface if the elements are displayed suboptimally.
Can I set different DP values for different applications?
No, the minimum width of DP is a system parameter that applies to the entire interface, but some applications (like Nova Launcher) allow you to scale icons and text regardless of the system settings.