Android nested layouts

后端 未结 2 1184
暖寄归人
暖寄归人 2020-12-18 03:22

I am new to android layouts, Could please tell me how the performance of application when using nested layouts instead of using layout below, layout above, layout right, la

相关标签:
2条回答
  • 2020-12-18 03:55

    Well some layouts can only be made by doing some level of nesting. But you should avoid having too many nested LinearLayouts and even more important NEVER nest LinearLayouts with weights. You can read a little more about optimizing layouts in the official docs.

    Personally I use LinearLayouts for simple stuff and start using RelativeLayout when the layout gets more complex. There is no one answer as it is a matter of preference.

    0 讨论(0)
  • 2020-12-18 03:57

    Would highly recommend you a tool that's called Hierarchy Viewer. It's bundled with the SDK and you can find it under android-sdk/tools directory. In short, it helps find problems in your layouts by measuring time that takes them to be processed. A broader description of Hierarchy Viewer can be found here. Hope this helps.

    0 讨论(0)
提交回复
热议问题