使用React本机以不同的屏幕尺寸缩放UI缩放

发布于 2025-02-14 02:22:40 字数 111 浏览 21 评论 0 原文

我是编程的新手,目前我正在使用React Native来制作Android应用程序。现在,我只是在自己的物理智能手机中测试我的代码。我想知道是否更容易在维度上使用“%”单元以适当地缩放不同电话尺寸的应用程序。

I am very new to programming and I am currently using react native to make android applications. Now I am just testing out my code in my own physical smartphone. I want to know if it is more apt to use '%' unit in dimensions to properly scale apps in different phone sizes.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡水深流 2025-02-21 02:22:42

它取决于您的UI,就像您的UI外观一样,但是通用方法是使用React Antive默认视图属性,例如Flex,Flexbox,其根据您的UI具有不同的属性,因此它将在任何点上缩放您的UI,最高99%的设备。某些设备可能在很大程度上取决于分辨率和屏幕高度,因此您可以在宽度和高度上使用%,但仅记住特定条件而不是每个地方。

通用视图样式您可以引用此

https://reactnative.dev/docs/docs/docs/layout-props

https://reaectnative.dev/docs/image-style-props

https://reaectnative.dev/docs/shadow-props

https://reaectnative.dev/docs/view-style-style-props

您可以参考此示例,以便了解我们可以如何创建概括

https://code.tutsplus.com/tutorials/common-reacect-native-native-layouts-layouts-login-page-page-cms-cms-cms-27639

It depends upon your UI like how your UI is look like, But general approach is use react native default view property like flex, flexbox which have different property as per your UI so it will scale your UI in any point upto 99% of devices. Some of devices may very depend on resolution and screen height so for that you can use % in width and height but remember only specific condition not every where .

General View style you can refer this

https://reactnative.dev/docs/layout-props

https://reactnative.dev/docs/image-style-props

https://reactnative.dev/docs/shadow-props

https://reactnative.dev/docs/text-style-props

https://reactnative.dev/docs/view-style-props

For simple login screen UI you can refer this example so you can get idea how react native UI we can create generalize

https://code.tutsplus.com/tutorials/common-react-native-app-layouts-login-page--cms-27639

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文