溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

android實現(xiàn)綜合布局

發(fā)布時間:2020-06-08 14:06:14 來源:網(wǎng)絡(luò) 閱讀:285 作者:matengbing 欄目:移動開發(fā)

android實現(xiàn)綜合布局

要實現(xiàn)這種效果,

  1. LinearLayout的嵌套實現(xiàn)    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"   在指定組件下邊
     -->
向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI