android 自学笔记2-布局

发布时间:2020-07-31 08:49:52 作者:13764987389
来源:网络 阅读:252

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-布局

推荐阅读:
  1. 【学习笔记】Android常用布局
  2. android五个布局

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

android 布局 roi

上一篇:文件操作,路径操作,StringIO和BytesIO,序列化反序列化,正则表达式与python中使用

下一篇:vuejs7-v-for指令

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》