【隨筆】Android界面與Html界面大致可以聯繫起來(學生管理界面)

將慢慢更新。。。慢慢摸索Android的xml佈局標籤與html佈局標籤的相似。

 1.xml裏面的LinearLayout相當於html的div

因爲RelativeLayout的佈局相對來說比較自由,下面嘗試在相對佈局(RelativeLayout)xml下使用LinearLayout。

看代碼時,可以把LinearLayout 看成div

<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"
>
    
    <LinearLayout 
        android:id="@+id/info"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <TextView 
            android:id="@+id/xm"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="姓名:"
            android:textSize="18dp"/>
        <EditText 
            android:id="@+id/shuru_xm"
            android:layout_weight="0.7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
        <TextView 
            android:id="@+id/xh"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="學號:"
            android:textSize="18dp"/>
        <EditText 
            android:id="@+id/shuru_xh"
            android:layout_weight="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
    </LinearLayout>
	
    <LinearLayout 
        android:id="@+id/xb_xuanze"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/info">
        <TextView
            android:id="@+id/xb"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="性別:"
            android:textSize="18dp"/>
        
        <RadioGroup 
            android:id="@+id/xb_group"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <RadioButton
                android:id="@+id/nanhai"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="男"
            android:textSize="18dp"/>

            <RadioButton
                android:id="@+id/nvhai"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="女" 
            	android:textSize="18dp"/>
        </RadioGroup>

    </LinearLayout>
    
	<LinearLayout 
	    android:id="@+id/mz_xuanze"
	    android:layout_width="fill_parent"
	    android:layout_height="wrap_content"
	    android:layout_below="@+id/xb_xuanze">
	    <TextView 
	        android:id="@+id/mz"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:text="民族:"
	        android:textSize="18sp"/>
	    <Spinner 
	        android:id="@+id/mz_lb"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:textSize="18sp"/>
	</LinearLayout>

</RelativeLayout>

這裏只是講xml佈局標籤與html佈局標籤的div相似而已。可以根據這種方式來繼續寫學生管理界面。


爲避免作業相似,改日附上網格佈局學生管理界面、表格佈局學生管理界面demo。

發佈了46 篇原創文章 · 獲贊 36 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章