安卓布局layout方面源码汇总

  安卓布局layout方面源码汇总下载

布局layout定义了用户界面的虚拟结构

Android TableLayout Example

Android RelativeLayout Example

Android LinearLayout Example

Android 动态 和XML layout

Android: 平滑列表滚动Smooth List Scrolling

Android – Dashboard design pattern implementation

Android: 带有帐户选择器的导航抽屉Navigation drawer with account picker – Google Drive SDK

可扩展Expandable List in Android

Build Brighter Apps: 在Android中使用颜色

Android 页头Header和页尾Footer layout example

Android 固定页头和页尾 带有滚动条的layout example

Android SlidingPaneLayout: Tutorial

 

 

多个LayOut汇总源码下载:

activity_main.xml:

<RelativeLayout 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"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity"
    tools:ignore="Deprecated"  >

    <TextView
        android:id="@+id/textRelative"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/different_layouts" />
    
    <AbsoluteLayout
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:id="@+id/absoluteLayout"
        android:layout_below="@id/textRelative"
        android:background="#aaaaaa" >
       
        <TextView
               android:id="@+id/textAbsolute"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:layout_x="30dp"
                android:layout_y="10dp"
               android:text="@string/absolute_layout" />
    </AbsoluteLayout>
   
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#fff000"
        android:layout_below="@id/absoluteLayout"
        android:id="@+id/linearLayout"
        android:orientation="horizontal" >
       
        <TextView
               android:id="@+id/textLinear"
               android:layout_width="0dp"
               android:layout_height="wrap_content"
               android:layout_weight="1"
               android:text="@string/linear_layout" />
       
        <Button
            android:id="@+id/linearButton"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/linear_button" />
       
    </LinearLayout>
   
    <TableLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/linearLayout"
            android:id="@+id/tableLayout"
            android:background="#0fffff"
            android:layout_marginTop="10dp" >
           
            <TableRow>
             <TextView
                android:text="@string/tableRow1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_column="1" />
          </TableRow>
          <TableRow>
              <TextView
                android:text="@string/tableRow2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_column="2" />
          </TableRow>
   </TableLayout>
  
    <FrameLayout
          android:layout_width="match_parent"
          android:layout_height="50dp"
          android:layout_below="@id/tableLayout"
          android:id="@+id/frameLayout"
          android:background="#aa5511" >
         
       <TextView
               android:id="@+id/textFrame"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:layout_gravity="top|center"
               android:textStyle="bold"
               android:text="@string/frame_layout" />
         
          <ImageView
                 android:src="@drawable/ic_launcher"
                 android:layout_height="35dp"
                 android:layout_width="35dp"
                 android:layout_gravity="bottom|right"
                 android:contentDescription="@string/default_image" />
   </FrameLayout>

    <ListView
          android:id="@+id/list"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_below="@id/frameLayout" >
   </ListView>

</RelativeLayout>