溫馨提示×

溫馨提示×

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

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

android 自學筆記2-布局

發(fā)布時間:2020-07-31 08:49:52 來源:網(wǎng)絡(luò) 閱讀:257 作者:13764987389 欄目:移動開發(fā)

1.LinearLayout

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >
    
<!--     <Button  -->
<!--         android:id="@+id/button1" -->
<!--         android:layout_width="wrap_content" -->
<!--         android:layout_height="wrap_content" -->
<!--         android:layout_gravity="top" -->
<!--         android:text="Button 1" -->
<!--         /> -->
<!--     <Button  -->
<!--         android:id="@+id/button2" -->
<!--         android:layout_width="wrap_content" -->
<!--         android:layout_height="wrap_content" -->
<!--         android:layout_gravity="center_vertical" -->
<!--         android:text="Button 2" -->
<!--         /> -->
<!--     <Button  -->
<!--         android:id="@+id/button3" -->
<!--         android:layout_width="wrap_content" -->
<!--         android:layout_height="wrap_content" -->
<!--         android:layout_gravity="bottom" -->
<!--         android:text="Button 3" -->
<!--         /> -->
    
<EditText 
    android:id="@+id/input_message"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="2"
    android:hint="Type Something" />

<Button 
    android:id="@+id/send"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    
    android:text = "Send"
    />
    
</LinearLayout>

2.RelativeLayout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <Button 
        android:id="@+id/button3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="Button 3" />
        
        
    <Button 
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
		android:layout_toLeftOf="@id/button3"
		android:layout_above="@id/button3"
        android:text="Button 1"
        />

    <Button 
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
		android:layout_alignLeft="@id/button3"
        android:text="Button 2"
        />
    <Button 
        android:id="@+id/button4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
		android:layout_toLeftOf="@id/button3"
		android:layout_below="@id/button3"
        android:text="Button 4" />    
    
<Button 
        android:id="@+id/button5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
		android:layout_toRightOf="@id/button3"
		android:layout_below="@id/button3"
        android:text="Button 5" />    
</RelativeLayout>

3.FrameLayout

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <Button 
        android:id="@+id/button3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="Button 3" />
        
 <ImageView 
     android:id="@+id/p_w_picpathview"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:src="@drawable/ic_launcher"
     />
    
</FrameLayout>

4.TableLayout

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:stretchColumns="1"
    >
    
    


    <TableRow >
        <TextView 
            android:layout_height="wrap_content"
            android:text="Account:"
            />
 		<EditText 
 		    android:id="@+id/account"
 		    android:layout_height="wrap_content"
			android:hint="input your account"
 		    /> 
 		    
 		
    </TableRow>
   
    <TableRow >
        <TextView 
            android:layout_height="wrap_content"
            android:text="Password:"
            />
 		<EditText 
 		    android:hint="@+id/password"
 		    android:layout_height="wrap_content"
 		    android:inputType="textPassword"
 		    />       
    </TableRow> 

    
    <TableRow>
        <Button 
            android:id="@+id/button"
            android:layout_height="wrap_content"
            android:layout_span = "2"
            android:text="Login"
            />
        
    </TableRow>
    
    
    
    
</TableLayout>

android 自學筆記2-布局

向AI問一下細節(jié)

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

AI