Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
开发者_JAVA百科 Improve this questionI am using Absolute layout for my UI design in android.
My doubt is which layout is best for UI design in android and Is it the design is change in any other device. That means i am using HTC Desire to test my application if i installed my app in any other app means the design is change or look like same
Thanks in Advance
AbsoluteLayout
is definitely worst-practice for android.
Get to love the RelativeLayout
. It will make your life much easier, when designing for multiple resolutions/densities. If you have an old SDK, update your eclipse plugin. It has graphical snap-lines for RelativeLayouts similar to designing a form in Visual Studio, so you can see what is anchored where. It's really quite good.
Do not use AbsoluteLayout! The Android Doc says:
This class is deprecated. Use FrameLayout, RelativeLayout or a custom layout instead.
Those layouts will adapt to different screen sizes, whereas AbsoluteLayout will not.
I always go for LinearLayout over all other layout.Working with RelativeLayout is very hard as all the components are placed relatively to each other so if you want to move a component slightly you will have to sweat it out!!
Depends on your design. It's a nice question. Layouts are a very important concept of desiging. I usually prefer linearLayout and relative layout.
Use frameLayout if you want to display a textView on an ImageView and don't worry about different handsets. It will adapt accordingly. Study Nine-patch image.
精彩评论