android:layout_width和android:width的区别

来源:互联网 发布:软件随想录 txt 编辑:程序博客网 时间:2024/05/16 08:33
<TextView android:id="@+id/text11"android:layout_width="wrap_content"android:layout_height="fill_parent"android:layout_weight="1"android:text="layout_text2"android:background="#aa0000"></TextView>

基中的android:layout_width和android:width的区别:

  • android:layout_width 只有两种选择一个是fill_parent ,二是wrap_content
  • android:width 这个是用来view的具体宽度的,以像素为单位。

android:width 支持

  • px (pixels)像素
  • dip (device independent pixels)设备独立像素
  • sp (scaled pixels ― best for text size)放大像素--对文本大小最好
  • pt (points) 点
  • in (inches)英寸
  • mm (millimeters)毫米

这是在网上找的答案,自己也没有试过……我想基本的区别还是有的!