如何在Android的创造液体布局 [英] How to create Liquid Layout in android

查看:152
本文介绍了如何在Android的创造液体布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我进入大学的一个项目,我想知道我怎么可以在Android的使用液态布局,使不同的屏幕尺寸,必须根据其分辨率查看应用程序?

I am into a project in university, I would like to know that how can I use liquid layout in android so that different screen sizes must see the application according to its resolution?

在简单的话,我想创建一个应用程序,其布局是在屏幕:)所有类型的完美

In simple words, I would like to create an application whose layout is perfect in all the type of screens :)

我知道如何在简单的HTML / CSS创建它的网站用于个人电脑,但如何做到这一点在Android的?

I know how to create it in simple html/css in websites for PCs, but how to do it in android?

任何人都可以请大家给点建议/帮助/教程链接?

Can anyone please give suggestions/help/tutorial link?

谢谢,
乌斯曼

Thanks, Usman

推荐答案

Android提供了液体布局开箱 - 布局尺寸和包含的元素自动适应屏幕分辨率。它是由优雅Android框架处理。有各种样的可用布局(LinearLayout中,的FrameLayout等),所以你需要仔细检查一下其中的布局类型是最适合你。

Android provides "liquid" layouts out of the box - the layout dimensions and contained elements adapt to screen resolution automatically. It is gracefully handled by the Android framework. There are various kind of layouts available (LinearLayout, FrameLayout etc.) so you need to check carefully which type of layout is the best for you.

您应该避免AbsoluteLayout。虽然这是事实它允许您指定精确位置及其子女(x / y坐标),它不太灵活,难以维持比其他类型的布局没有绝对定位。现在反正pcated德$ P $。

You should avoid AbsoluteLayout. While it is true it lets you specify exact locations (x/y coordinates) of its children it is less flexible and harder to maintain than other types of layouts without absolute positioning. It is now deprecated anyway.

相关链接:


  • 要了解更多有关不同的布局参见:<一href=\"http://developer.android.com/guide/topics/ui/layout-objects.html\">http://developer.android.com/guide/topics/ui/layout-objects.html

  • 好的教程,也可以在这里:<一href=\"http://developer.android.com/resources/tutorials/views/index.html\">http://developer.android.com/resources/tutorials/views/index.html在布局部分。

  • AbsoluteLayout DOC:<一href=\"http://developer.android.com/reference/android/widget/AbsoluteLayout.html\">http://developer.android.com/reference/android/widget/AbsoluteLayout.html

  • To read more about different layouts see: http://developer.android.com/guide/topics/ui/layout-objects.html
  • Good tutorials are also available here: http://developer.android.com/resources/tutorials/views/index.html in the "Layouts" section.
  • AbsoluteLayout doc: http://developer.android.com/reference/android/widget/AbsoluteLayout.html

更新:

布局本身会自动适应不同的分辨率,但你需要保持介意包含在布局元素可以看看不同。相同的图像将是高分辨率的屏幕上比低分辨率的屏幕较小。幸运的是,Android提供了方法来处理一个简单的方式来解决此问题。您可以提供取决于设备具有不同分辨率的图像(这是一个有点简单化,因为还有其他的因素如:像素密度中除了重要的分辨率)。由于同样的原因,也有可能以提供不同的布局,但它不是常见

Layout itself will adapt to different kind of resolutions automatically but you need to keep it mind that elements contained in a layout can look differently. The same image will be smaller on high-res screen than on low-res screen. Luckily, Android provides a way to deal with this problem in a simple manner. You can supply different images depending on the resolution that a device has (this is a bit of a simplification because there are other factors eg. pixel density in addition to resolution that matters). By the same token, it is also possible to supply a different layout but it is not that common.

链接:


  • 在多屏幕支持完整的故事:<一href=\"http://developer.android.com/guide/practices/screens_support.html\">http://developer.android.com/guide/practices/screens_support.html

  • 样品code:<一href=\"http://developer.android.com/resources/samples/MultiResolution/index.html\">http://developer.android.com/resources/samples/MultiResolution/index.html

这篇关于如何在Android的创造液体布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆