android實現綜合布局

來源:互聯網
上載者:User

標籤:android實現綜合布局

650) this.width=650;" src="http://s1.51cto.com/wyfs02/M02/8B/49/wKioL1hJCTrQbAorAAHeWdhDusU595.png-wh_500x0-wm_3-wmp_4-s_1480552663.png" title="捕獲.PNG" alt="wKioL1hJCTrQbAorAAHeWdhDusU595.png-wh_50" />

要實現這種效果,

  1. LinearLayout的嵌套實現    2.使用RelativeLayout


  2. <?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:paddingLeft="10dp"      android:paddingRight="10dp"      >             <EditText         android:id="@+id/EditText1"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:hint="@string/reminder"    />               <LinearLayout          android:layout_width="match_parent"         android:layout_height="wrap_content"         android:orientation="horizontal"         >          <EditText         android:id="@+id/dates"        android:layout_width="0dp"        android:layout_height="wrap_content"android:layout_weight="1"                />         <EditText         android:id="@+id/times"        android:layout_width="100dp"        android:layout_height="wrap_content"                  />          </LinearLayout>             <Button          android:id="@+id/button1"         android:layout_width="96dp"         android:layout_height="wrap_content"         android:layout_gravity="right"         android:text="提交"         /></LinearLayout>


  3. <?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"     android:paddingLeft="10dp"    android:paddingRight="10dp"    >    <EditText         android:id="@+id/EditText1"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:hint="@string/reminder"    />    <EditText         android:id="@+id/dates"        android:layout_width="wrap_content"        android:layout_height="wrap_content"android:layout_below="@id/EditText1"android:layout_alignParentLeft="true"    android:layout_toLeftOf="@+id/times"                 />         <EditText         android:id="@+id/times"        android:layout_width="100dp"        android:layout_height="wrap_content"android:layout_below="@+id/EditText1"android:layout_alignParentRight="true"                     />          <Button          android:id="@+id/button1"         android:layout_width="96dp"         android:layout_height="wrap_content"         android:layout_below="@id/times"         android:layout_alignParentRight="true"         android:text="提交"         />    </RelativeLayout><!--  android:layout_alignParentLeft="true"    和父控制項靠左對齊android:layout_toLeftOf="@+id/times" 在指定組件左邊android:layout_below="@id/EditText1"   在指定組件下邊 -->

本文出自 “matengbing” 部落格,請務必保留此出處http://matengbing.blog.51cto.com/11395502/1880754

android實現綜合布局

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.