Use of Android:weight
Last Update:2015-05-28
Source: Internet
Author: User
<span id="Label3"></p> <table cellspacing="0" cellpadding="0" width="1118" style="width:718px;"> <tbody> <tr> <td class="t_f" id="postmessage_1520" style="font-size:14px;"><p><p><span style="color:#000;"><span style="font-family:Helvetica, Tahoma, Arial, sans-serif;"><span style="font-family:Tahoma, Helvetica, SimSun, sans-serif;">Android</span>: Weight property to display controls at set scale based on phone aspect</span></span></p></p><p><p><span style="color:#000;"><span style="font-family:Helvetica, Tahoma, Arial, sans-serif;">Such as:</span></span></p></p><p><p><span style="color:#000;"><span style="font-family:Helvetica, Tahoma, Arial, sans-serif;">Proportional Display on width</span></span></p></p><p><span style="color:#000;"><span style="font-family:Helvetica, Tahoma, Arial, sans-serif;"><linearlayout<br>android:layout_margintop= "5dp"<br>Android650) this.width=650; "src=" http://techfoxbbs.com/static/image/smiley/default/shocked.gif "border=" 0 "/> rientation= "horizontal"<br> <span style="font-weight:700;"><span style="font-weight:700;">android:layout_width= "fill_parent"----------------to make it full-width</span></span><br>android:layout_height= "wrap_content" ><br><button<br>Android:id= "@+id/first_sex1_4"<br>android:layout_marginleft= "15dp"<br><span style="font-weight:700;"><span style="font-weight:700;">android:layout_width= "0dp"</span></span>---------set the 0DP so that the width is generated proportionally<br><span style="font-weight:700;"><span style="font-weight:700;">android:layout_weight= "1"</span></span><br>android:layout_height= "50dp"/><br><button<br>Android:id= "@+id/first_sex1_5"<br>android:layout_marginleft= "5dp"<br><span style="font-weight:700;"><span style="font-weight:700;">android:layout_width= "0dp"</span></span><br><span style="font-weight:700;"><span style="font-weight:700;">android:layout_weight= "3"</span></span><br>android:layout_height= "50dp"/><br></LinearLayout></span></span></p><p><p><span style="color:#000;"><span style="font-family:Helvetica, Tahoma, Arial, sans-serif;">Note Now <span style="font-weight:700;">android:layout_width= "0dp"</span></span></span></p></p><p><p><span style="color:#000;"><span style="font-family:Helvetica, Tahoma, Arial, sans-serif;">The final 3 buttons display a width ratio of 1:3, as with weight, with high weights and large display widths</span></span></p></p><br><p><p><span style="color:#000;"><span style="font-family:Helvetica, Tahoma, Arial, sans-serif;">But if you put <span style="font-weight:700;">android:layout_width= "fill_parent"</span></span></span></p></p><p><span style="color:#000;"><span style="font-family:Helvetica, Tahoma, Arial, sans-serif;"><linearlayout<br>android:layout_margintop= "5dp"<br>Android650) this.width=650; "src=" http://techfoxbbs.com/static/image/smiley/default/shocked.gif "border=" 0 "/> rientation= "horizontal"<br><span style="font-weight:700;"><span style="font-weight:700;">android:layout_width= "fill_parent"----------------to make it full-width</span></span><br>android:layout_height= "wrap_content" ><br><button<br>Android:id= "@+id/first_sex1_4"<br>android:layout_marginleft= "15dp"<br><span style="font-weight:700;"><span style="font-weight:700;">android:layout_width= "</span></span><span style="font-weight:700;"><span style="font-weight:700;"> <span>fill_parent</span>"</span></span>---------settings<span style="font-weight:700;"><span style="font-weight:700;">fill_parent</span></span>, let the width be generated by scale<br><span style="font-weight:700;"><span style="font-weight:700;">android:layout_weight= "1"</span></span><br>android:layout_height= "50dp"/><br><button<br>Android:id= "@+id/first_sex1_5"<br>android:layout_marginleft= "5dp"<br><span style="font-weight:700;"><span style="font-weight:700;">android:layout_width= "</span></span><span style="font-weight:700;"><span style="font-weight:700;"> <span>fill_parent</span>"</span></span><br><span style="font-weight:700;"><span style="font-weight:700;">android:layout_weight= "3"</span></span><br>android:layout_height= "50dp"/><br></LinearLayout></span></span></p><p><p><span style="color:#000;"><span style="font-family:Helvetica, Tahoma, Arial, sans-serif;">Note Now <span style="font-weight:700;">android:layout_width= "</span><span style="font-weight:700;"><span><span>fill_parent</span></span>"</span></span></span></p></p><p><p><span style="color:#000;"><span style="font-family:Helvetica, Tahoma, Arial, sans-serif;">The final 3 buttons display a width ratio of 3:1, and weight opposite, The value of a large weight is low, the display width is small</span></span></p></p></td> </tr> </tbody> </table><p><p><br></p></p><p><p>Use of Android:weight</p></p></span>