我怎样才能制作在平板电脑和手机中都可以使用的布局? [英] How can i made the layout that will work in both Tablet and phone?
问题描述
我用模拟器大小的平板电脑布局从xml制作了布局.但是当在 android 手机设备上以相同的布局打开时,每件事都会扭曲,所以我可以制作一个 xml 布局,它也可以在设备手机和平板电脑上正常工作.请给我建议,感谢您的回答.
I made the layout from xml with on tablet layout of emulator size. But when open on same layout on android phone device then every thing distorted, So can i make a xml layout that will work fine in both of device phone and tablet also. Please suggest me, appreciate your answer.
推荐答案
让你的资源像这样.
res/layout/my_layout.xml//正常屏幕尺寸的布局(默认")
res/layout/my_layout.xml // layout for normal screen size ("default")
res/layout-small/my_layout.xml//小屏幕布局
res/layout-large/my_layout.xml//大屏幕布局
res/layout-xlarge/my_layout.xml//超大屏幕的布局
res/layout-xlarge-land/my_layout.xml//横向超大布局
res/drawable-mdpi/my_icon.png//中等密度位图
res/drawable-hdpi/my_icon.png//高密度位图
res/drawable-xhdpi/my_icon.png//超高密度位图
将此添加到您的 manifest.xml
Add this in your manifest.xml
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens= "true"
android:anyDensity="true"
/>
希望对你有帮助.
这篇关于我怎样才能制作在平板电脑和手机中都可以使用的布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!