android 05 桢布局:FrameLayout 网格布据 GridLayout
xml文件:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:layout_width="128dp" android:layout_height="128dp" android:src="@drawable/p03"/> 图片 <ImageView android:layout_width="64dp" android:layout_height="64dp" android:src="@drawable/p02"/> <ImageView android:layout_width="32dp" android:layout_height="32dp" android:src="@drawable/p01"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="20sp" android:textColor="#000" android:text="查看图片" android:layout_gravity="bottom|center_horizontal"/> </FrameLayout>
网格布局:GridLayout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <GridLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:columnCount="5" 跨列 android:orientation="horizontal" > <TextView android:text="用户名" /> <EditText android:layout_columnSpan="4" 跨行 android:layout_gravity="fill_horizontal" android:hint="2-10个字符" /> <TextView android:text="密 码" /> <EditText android:layout_columnSpan="4" android:layout_gravity="fill_horizontal" android:hint="2-10个字符" /> </GridLayout> <GridLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:columnCount="5" android:orientation="horizontal" android:layout_marginTop="20dp"> <Button android:text="不" android:visibility="invisible" /> <Button android:background="@drawable/btn_bg" android:drawableLeft="@drawable/login32x32" android:text="登陆" android:textColor="#fff"/> <Button android:text="不" android:visibility="invisible" /> <Button android:background="@drawable/btn_bg" android:drawableLeft="@drawable/exit32x32" android:text="退出" android:textColor="#fff"/> <Button android:text="不" android:visibility="invisible" /> </GridLayout> </LinearLayout>