设为首页 加入收藏

TOP

Margin和Padding的区别
2017-10-11 16:57:17 】 浏览:2089
Tags:Margin Padding 区别

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>

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇EditText实现输入限制和校验 下一篇RadioButton实现多选一

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目