Android中将layout_widthまたはlayout_heightが0に設定されている場合

655 ワード

viewのlayout_を使うとWeightプロパティの場合、layout_widthは0に設定されています.これは、システムが長さまたは幅の計算を1回減らすことができるためです.
公式の解釈は以下の通りです.
In order to improve the layout efficiency when you specify the weight, you should change the width of the EditText  to be zero (0dp). Setting the width to zero improves layout performance because using "wrap_content"  as the width requires the system to calculate a width that is ultimately irrelevant because the weight value requires another width calculation to fill the remaining space.
例: