我本是想整理下布局文件的相关知识(见上一篇日志)
发现width和layout_width的问题很是纠结
百度上找了半天,竟是胡说八道的。。。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.对于填写内容是这样:
### 应该是 “数dip”
@@@应该填 "fill_parent","wrap_content","match_parent" 注意也可填“数dip”
2.字面上看带layout_的是指跟父控件之间的关系,又如layout_weight按比重占父控件的地
所以这个容易解释,但width呢!?难道就感觉级别低?
起初我也猜测是这样,###和@@@试了添了几组数
<TextView
android:id="@+id/TextView01"
android:background="#0000ff"
android:width=###
android:layout_width=@@@
android:layout_height="wrap_content"
android:text="111111111111111"
/>
最终的结论是 android:width与android:layout_width并无级别之分
是先后之分(当然不是代码的先后!)
先 声明 android:width=“Xdip” (X<屏幕宽度)
后 如果 android:layout_width="wrap_content"(内容>Xdip)、“>Xdip”、“fill_parent” 那么该越界就越界
如果 android:layout_width="wrap_content"(内容<Xdip)、“<Xdip” 那么宽度就是Xdip
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
同理android:height与android:layout_height也如此