.Net程式員玩轉Android開發---(3)登陸頁面配置,.netandroid

來源:互聯網
上載者:User

.Net程式員玩轉Android開發---(3)登陸頁面配置,.netandroid

                        這一節我們來看看登陸頁面怎樣布局,對於剛接觸到Android開發的童鞋來說,Android的布局感覺比較棘手,需要結合各種屬性進行設定,接下來我們由點入面來

瞭解安卓中頁面怎樣布局,登陸頁面很簡單,兩個文字框和一個按鈕,頁面效果如下:

                       

            1.布局代碼

                       點擊activity_mail.xml可以查看布局代碼

                       點擊graphical Layout切換到設計表單

                        全部代碼

                        

<LinearLayout    xmlns:android="http://schemas.android.com/apk/res/android"    android:orientation="vertical"    android:layout_width="fill_parent"    android:layout_height="fill_parent">   <LinearLayout android:layout_width="fill_parent"  android:layout_weight="0.9" android:layout_height="fill_parent">    </LinearLayout>   <LinearLayout   android:layout_width="fill_parent"  android:layout_weight="0.1"  android:orientation="vertical"  android:layout_height="fill_parent">          <LinearLayout    android:layout_marginLeft="10px"    android:layout_marginRight="10px"    android:gravity="center"    android:layout_width="fill_parent"    android:orientation="horizontal"    android:layout_height="wrap_content">            <TextView android:textSize="8pt"    android:text="使用者名稱"    android:layout_weight="0.75"    android:layout_width="fill_parent"    android:layout_height="wrap_content">                    </TextView>                <EditText     android:layout_weight="0.25"     android:layout_width="fill_parent"     android:text="請輸入使用者名稱"     android:layout_height="wrap_content">                    </EditText>            </LinearLayout>  <LinearLayout android:layout_marginLeft="10px"android:layout_marginRight="10px"android:gravity="center"android:layout_width="fill_parent"android:orientation="horizontal"android:layout_height="wrap_content">            <TextView android:textSize="8pt"         android:text="密碼"           android:layout_weight="0.75"             android:layout_width="fill_parent"             android:layout_height="wrap_content">                    </TextView>              <EditText  android:layout_weight="0.25"   android:layout_width="fill_parent"  android:password="true" android:text="請輸入密碼" android:layout_height="wrap_content">        </EditText>            </LinearLayout>          <LinearLayout   android:layout_marginLeft="10px"  android:layout_marginRight="10px" android:gravity="center"    android:layout_width="fill_parent" android:orientation="horizontal" android:layout_height="wrap_content">     <Button android:text="登入"    android:textSize="9pt"  android:layout_width="fill_parent"    android:layout_height="wrap_content">   </Button>      </LinearLayout>     <LinearLayout   android:layout_marginLeft="10px"  android:layout_marginRight="10px" android:gravity="center"    android:layout_width="fill_parent" android:orientation="horizontal" android:layout_height="wrap_content">     <Button android:text="註冊 "    android:textSize="9pt"  android:layout_width="fill_parent"    android:layout_height="wrap_content">   </Button>      </LinearLayout>  </LinearLayout>    </LinearLayout>


            2. 屬性說明

                          控制項介紹

                                LinearLayout控制項: 線性布局控制項 ,顧名思義就是以線性方式展示,包括橫向和總向兩種線性方式

                                  android:orientation="vertical"表示垂直方向,android:orientation="horizontal"表示水平方向

                                TextView控制項:顯示控制項,類似於label標籤控制項

                                EditText控制項:文字框控制項,類似於TextBox控制項

                               Button按鈕控制項

                          屬性說明

                            layout_width:表示控制項相對於父容器的寬度。有三個值 fill_parent   wrap_content  match_parent

                             fill_parent 表示填充整個螢幕寬度

                             wrap_content 表示匹配文字的寬度

                             android:orientation="vertical" 設定水平和垂直方向

                             android:orientation="vertical"  設定控制項左邊距

                             android:layout_weight 設定控制項所佔的百分比

                             android:gravity="center"  設定控制項內的元素位置

                              android:layout_gravity   用來指控制項在父控制項中的位置

                             


C#語言 開發網站程式 程式員的困惑(net程式員回答)

程式員不是一份工作,在中國寫程式要成為興趣和追求才能堅持到最後。如果不是這樣,你還是不要涉足。
 
JAVA程式員與C#/NET程式員那個可以更快的開發Android應用程式?

如果源碼java會快一些,如果用像完美e端這樣的工具,.net會快一點
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.