android weight attribute positive solution

To use weight correctly, don't bother anymore 

android:layout_width="match_parent"

 How to set weight in android:layout_width="wrap_content"  two cases. Because this setting is simply wrong usage.

The correct usage is:

First set android:layout_width="0dp" or android:layout_height="0dp"

Then adjust the weights

And the weight at this time is also very easy to understand: weight is the proportion! Proportion! Please see the figure below

Correct solution of android weight attribute: [2]android
Correct solution of android weight attribute: [2]android
Correct solution of android weight attribute: [2]android

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325809170&siteId=291194637