码迷,mamicode.com
首页 > 其他好文 > 详细

Margin和Padding的区别

时间:2017-08-05 14:49:14      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:span   top   coding   back   into   xmlns   parent   enc   round   

Margin和Padding的区别

一、简介

技术分享

 

二、实例

效果图

技术分享

代码

/MarginAndPadding/res/layout/activity01.xml

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     android:orientation="vertical" >
 6 
 7     <TextView 
 8         android:layout_width="wrap_content"
 9         android:layout_height="wrap_content"
10         android:background="@android:color/darker_gray"
11         android:text="margin案例一"
12         android:layout_marginTop="30dp"
13         android:layout_marginLeft="30dp"
14         />    
15         
16     <TextView 
17         android:layout_width="wrap_content"
18         android:layout_height="wrap_content"
19         android:background="@android:color/darker_gray"
20         android:text="margin案例二"
21         android:layout_margin="60dp"
22         />    
23         
24     <TextView 
25         android:layout_width="wrap_content"
26         android:layout_height="wrap_content"
27         android:background="@android:color/darker_gray"
28         android:text="padding案例一"
29         android:layout_alignParentRight="true"
30         android:paddingTop="30dp"
31         android:paddingLeft="30dp"
32         />    
33         
34     
35 </RelativeLayout>

 

Margin和Padding的区别

标签:span   top   coding   back   into   xmlns   parent   enc   round   

原文地址:http://www.cnblogs.com/Renyi-Fan/p/7290115.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!