Android上的线性布局基线对齐警告 [英] Linear Layout baselinealigned warning on android
问题描述
在使用LinearLayout时,我在此元素上收到为此元素设置android:baselineAligned ="false"以得到更好的性能",我知道它与性能有关的信息,但我不知道确切的原因,请澄清一下
i am getting "Set android:baselineAligned="false" on this element for better performance" while using LinearLayout, I know its regarding performance,but i dont know exactly why it is,please clarify me
推荐答案
android:baselineAligned/setBaselineAligned(boolean):设置为false时, 阻止布局调整其子项的基线.
android:baselineAligned/setBaselineAligned(boolean): When set to false, prevents the layout from aligning its children's baselines.
因此可以使用线性布局的示例,其中水平子视图具有多个TextView,具有不同的文本大小或不同的视图(例如按钮),则basealignment会有所不同,如果将其设置为false,则无法将其调整为具有相同的basealignment
So can take example with linear layout with horizontal child views having multiple TextView with different text size or different views like button there basealignment would be different and you cannot adjust it to have same basealignment if you set it to false
更新: 通过设置android:baselineAligned ="false",可以防止应用布局必须进行额外的工作才能对齐子级基线;可以明显提高性能. (更少的UI不必要的操作=>更好的性能),如这里
Update: By setting android:baselineAligned="false" , you're preventing the extra work your app's layout has to do in order to Align its children's baselines; which can obviously increase the performance. (Less unnecessary operations on UI => Better performance) as mentioned here
这篇关于Android上的线性布局基线对齐警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!