简体   繁体   English

如何在android中使用reactnative支持手机和桌面?

[英]how to support phones and tables using reactnative in android?

I am new to react native. 我是新来的本地人。 I am a native android developer. 我是一个原生的android开发人员。 In native android, different images/layouts can be used for different screen size/densities phones and for tablets. 在原生android中,不同的图像/布局可用于不同的屏幕尺寸/密度手机和平板电脑。 Layouts/images can also be changed when the orientation of the phone changes. 当手机的方向发生变化时,也可以更改布局/图像。 So is it possible to achieve this in reacting native? 那么有可能在本机中做出反应吗? and if yes how? 如果是的话怎么样?

Thanks in advance, 提前致谢,

Krishna 克里希纳

[This is an opinion (and experience) based answer, thus may be a bit out of scope of Stack Overflow] [这是基于意见(和经验)的答案,因此可能有点超出Stack Overflow的范围]

Yes it is. 是的。 It's possible to add different set of assets for different resolutions and pixel ratios. 可以为不同的分辨率和像素比添加不同的资产集。 (See: /[app-name]/android/app/src/main/res/ ) (参见: / [app-name] / android / app / src / main / res /

It's also possible to get Dimensions and PixelRatio for layout specific sets. 也可以为特定于布局的集合获取DimensionsPixelRatio If you need (and you probably need) to do relative positioning, flexible layouts etc, then these + Flexbox helps you. 如果您需要(并且您可能需要)进行相对定位,灵活布局等,那么这些+ Flexbox可以帮助您。

So I suggest you to start by doing something simple and playing with these. 所以我建议你从做一些简单的事情开始,然后玩这些。 In addition, do some googling about the topic, there are blog posts, 3rd party components and other resources available. 此外,做一些关于该主题的谷歌搜索,有博客文章,第三方组件和其他资源可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM