android:layout_width只能设置fill_parent(横向填充整个屏幕)或wrap_content(横向填充控件本身大小)
android:width设置具体控件的横向大小单位是像素

FrameLayout, LinearLayout , AbsoluteLayout, RelativeLayout, TableLayout.

----- FrameLayout-----

Demo1:

activity_main.xml

ok

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent" >    <EditText        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:layout_marginTop="100dp"        android:inputType="textPassword" />    <TextView        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:text="@string/hello_world"        tools:context=".MainActivity" />    <Button        android:layout_width="fill_parent"        android:layout_height="fill_parent"        android:text="@string/hello"        android:textColor="#0000ff"        android:textColorHighlight="#aaaaaa"        android:textSize="20dp"        android:textStyle="bold"        tools:context=".MainActivity" />    <Button        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:text="@string/world"        android:textColor="#333333"        android:textStyle="italic"        tools:context=".MainActivity" /></FrameLayout>

res/values/目录下的xml文件中设置@string对应的value

----------

??

<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    ><ImageView      android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:src="@drawable/movie"    /><ImageView      android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:src="@drawable/play"    android:layout_gravity="center"    /></FrameLayout>

movie 和 play 是res/drawable目录下对应的图片文件名

----- LinearLayout(线性布局)-----

----

-----AbsoluteLayout(绝对布局)----

----

----

----

----RelativeLayout(相对布局) -----

----

----

----

----- TableLayout(表格布局) -----

----

----

----

----

----

更多相关文章

  1. Android学习笔记06:线性布局LinearLayout
  2. 界面布局
  3. android基础入门控件详解(3)
  4. Android 布局中 如何使控件居中
  5. 系出名门Android(7) - 控件(View)
  6. Android中的布局管理
  7. 相对布局控制控件居右显示
  8. android布局实例代码

随机推荐

  1. Handling Android 2.3 WebView's broken
  2. Android Unable to resolve target "Andr
  3. Android EditText默认不弹出输入法
  4. Android SQLite操作类--封装
  5. Android(安卓)常见面试题
  6. Twitter V1.1在Android中的应用
  7. Android低内存配置
  8. Android读取xxx.properties配置文件中文
  9. 保持在底部的按钮栏,上面是滚动的ScrollVi
  10. android studio 项目的版本问题