1. 程式人生 > >Fragment的簡單使用(切換介面)-FenGKun

Fragment的簡單使用(切換介面)-FenGKun

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" 
    android:background="#31C4F7">
    
    <!-- 上間隙 -->
    <View 
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="10"/>
    
    <!-- 標題 -->
    <TextView 
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="30"
        android:text="找工作"
        android:textColor="#fff"
        android:textSize="40sp"
        android:gravity="center"/>
    
    <!-- 間隙 -->
    <View 
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="15"/>
    
    <!-- 姓名 -->
     <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="15"
        android:orientation="horizontal"
        >
        
        <!-- 名稱 -->
        <TextView 
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="50"
            android:text="姓名:"
            android:textColor="#fff"
            android:textSize="20sp"
            android:gravity="right|center_vertical"/>
        
        <!-- 間隙 -->
        <View 
	        android:layout_width="0dp"
	        android:layout_height="match_parent"
	        android:layout_weight="2"/>
        <!-- 輸入框 -->
        <EditText android:id="@+id/etName"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="100"
            android:hint="請輸入姓名"
            android:background="#fff"
            android:gravity="left|center_vertical"
            android:paddingLeft="10dp"
            android:textSize="23sp"/>
        <!-- 間隙 -->
        <View 
	        android:layout_width="0dp"
	        android:layout_height="match_parent"
	        android:layout_weight="11"/>
        
    </LinearLayout>
    
    <!-- 間隙 -->
    <View 
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="20"/>
    
    <!-- 手機號 -->
     <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="15"
        android:orientation="horizontal"
        >
        
        <!-- 名稱 -->
        <TextView 
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="50"
            android:text="手機號:"
            android:textColor="#fff"
            android:textSize="20sp"
            android:gravity="right|center_vertical"/>
        
        <!-- 間隙 -->
        <View 
	        android:layout_width="0dp"
	        android:layout_height="match_parent"
	        android:layout_weight="2"/>
        <!-- 輸入框 -->
        <EditText android:id="@+id/etPhone"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="100"
            android:hint="請輸入手機號"
            android:background="#fff"
            android:gravity="left|center_vertical"
            android:paddingLeft="10dp"
            android:textSize="23sp"/>
        <!-- 間隙 -->
        <View 
	        android:layout_width="0dp"
	        android:layout_height="match_parent"
	        android:layout_weight="11"/>
        
    </LinearLayout>
    
    <!-- 間隙 -->
    <View 
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="20"/>
    
    <!-- 選擇工種 -->
    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="15"
        android:orientation="horizontal"
        >
        
        <!-- 名稱 -->
        <TextView 
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="50"
            android:text="選擇工種:"
            android:textColor="#fff"
            android:textSize="20sp"
            android:gravity="right|center_vertical"/>
        
        <!-- 間隙 -->
        <View 
	        android:layout_width="0dp"
	        android:layout_height="match_parent"
	        android:layout_weight="2"/>
        <!-- 選擇工種 -->
        <Spinner android:id="@+id/spType"
            android:layout_width="0dp"
            android:layout_weight="102"
            android:layout_height="match_parent"
            android:paddingLeft="10dp"
            android:textSize="23sp"
            android:prompt="@string/select">
        </Spinner>
            
        <!-- 間隙 -->
        <View 
	        android:layout_width="0dp"
	        android:layout_height="match_parent"
	        android:layout_weight="10"/>
        
    </LinearLayout>
    
    <!-- 間隙 -->
    <View 
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="20"/>
    
    <!-- 釋出 -->
    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="15"
        android:orientation="horizontal">
        
        <!-- 間隙 -->
        <View 
	        android:layout_width="0dp"
	        android:layout_height="match_parent"
	        android:layout_weight="1"/>
        
        <!-- 釋出 -->
        <Button android:id="@+id/btnCommit"
            android:layout_width="0dp"
            android:layout_weight="4"
            android:layout_height="match_parent"
            android:text="釋出"
            android:textColor="#fff"
            android:textSize="20sp"
            android:background="#E4BA3F"/>
        
        <!-- 間隙 -->
        <View 
	        android:layout_width="0dp"
	        android:layout_height="match_parent"
	        android:layout_weight="1"/>

        <!-- 重置 -->
        <Button android:id="@+id/btnReset"
            android:layout_width="0dp"
            android:layout_weight="4"
            android:layout_height="match_parent"
            android:text="重置"
            android:textColor="#fff"
            android:textSize="20sp"
            android:background="#E4BA3F"/>
        
        <!-- 間隙 -->
        <View 
	        android:layout_width="0dp"
	        android:layout_height="match_parent"
	        android:layout_weight="1"/>
        
    </LinearLayout>
    
    <!-- 底間隙 -->
    <View 
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="20"/>

</LinearLayout>
2、FindWorkFragment類的具體操作,裡面說的很詳細,我就不做解釋了