我總是使用LinearLayout和RelativeLayouts,並且我正在閱讀有關「新」PercentRelativeLayout。我有幾個問題:PercentRelativeLayout更具性能?
我是否應該總是開始使用這一個或僅在嵌套權重與linearlayout的情況下?
這是比其他更高性能嗎?
任何其他有關PercentRelativeLayout的信息將受到歡迎。
謝謝!
我總是使用LinearLayout和RelativeLayouts,並且我正在閱讀有關「新」PercentRelativeLayout。我有幾個問題:PercentRelativeLayout更具性能?
我是否應該總是開始使用這一個或僅在嵌套權重與linearlayout的情況下?
這是比其他更高性能嗎?
任何其他有關PercentRelativeLayout的信息將受到歡迎。
謝謝!
看看source code,PercentRelativeLayout基本上是一個RelativeLayout的小擴展。這意味着您需要與在RelativeLayout和LinearLayout之間進行選擇時一樣考慮。
最後值得注意的是儘可能多地取代這些結構是:
PercentRelativeLayout
只是RelativeLayout
一個擴展,所以我認爲:
1)U應如果使用線性佈局的嵌套權重,因爲它們對性能不利
2)否,但取決於您的useCase。對於例如: - 它具有比LinearLayout
和RelativeLayout
但超過LinearLayout
嵌套重量
而且U可以參考這篇文章從Android開發者較少的性能: http://developer.android.com/training/improving-layouts/optimizing-layout.html
嘗試%的支持圖書館PercentRelativeLayout和PercentFrameLayout
http://android-er.blogspot.in/2015/08/try-percentrelativelayout-and.html
在這裏你可以找到兩種佈局的最佳比較。