开发者

How to design a screen in android?

开发者 https://www.devze.com 2023-01-07 04:59 出处:网络
I am new to Android. 开发者_高级运维I wish to know how to design a screen by using java in Android.

I am new to Android.

开发者_高级运维

I wish to know how to design a screen by using java in Android.

Design via xml and design via java which one is the best?


Design via xml is easier to maintain. For example, if you have to change something in your UI you just change it in one xml file instead of looking for it in all your source code.

On the other side, in java you can do some staff more quickly. Let's say you need to display a matrix of button. In java you can create and display them with a loop instead of creating them via xml.

To sum up, it depends on what you have to do. If you need to design more or less static UIs, opt for xml and use Java only to edit them at runtime.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号