首页 > 其他 > 详细

Margin和Padding的区别

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

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的区别

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!