zoukankan      html  css  js  c++  java
  • padding与margin的区别

    padding          是控件的内容相对控件的边缘的边距.
    margin           是控件边缘相对父空间的边距.

    android:gravity    属性是对该view 内容的限定.比如一个button 上面的text. 你可以设置该text 在view的靠左,靠右等位置.该属性就干了这个.
    android:layout_gravity是用来设置该view中的子view相对于父view的位置.比如一个button 在linearlayout里,你想把该button放在靠左,靠右等位置就可以在linearlayout中通过该属性设置.

        <?xml version="1.0" encoding="utf-8"?>  
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
            android:orientation="vertical"  
            android:layout_width="fill_parent"  
            android:layout_height="fill_parent"  
            android:paddingLeft="10dip"  
            android:paddingRight="10dip"  
            android:paddingTop="10dip"  
            android:paddingBottom="10dip"  
            >  
        <TextView    
            android:layout_width="wrap_content"   
            android:layout_height="wrap_content"   
            android:background="#FF0000"  
            android:text="@string/hello"  
            android:paddingLeft="50dip"  
            android:paddingRight="50dip"  
            android:paddingTop="50dip"  
            android:paddingBottom="50dip"  
            android:layout_marginBottom="10dip"  
            />  
            <TextView    
            android:layout_width="wrap_content"   
            android:layout_height="wrap_content"   
            android:background="#FF0000"  
            android:text="@string/hello"  
            android:paddingLeft="50dip"  
            android:paddingRight="50dip"  
            android:paddingTop="50dip"  
            android:paddingBottom="50dip"  
            android:layout_marginBottom="10dip"  
            />  
            <TextView    
            android:layout_width="wrap_content"   
            android:layout_height="wrap_content"   
            android:background="#FF0000"  
            android:text="@string/hello"  
            android:paddingLeft="50dip"  
            android:paddingRight="50dip"  
            android:paddingTop="50dip"  
            android:paddingBottom="50dip"  
            android:layout_marginBottom="10dip"  
            />  
            <TextView    
            android:layout_width="wrap_content"   
            android:layout_height="wrap_content"   
            android:background="#FF0000"  
            android:text="@string/hello"  
            android:paddingLeft="50dip"  
            android:paddingRight="50dip"  
            android:paddingTop="50dip"  
            android:paddingBottom="50dip"  
            android:layout_marginBottom="10dip"  
            />  
        </LinearLayout>  

    转自网络,只是为了记忆。

  • 相关阅读:
    【凡尘】---react-redux---【react】
    React生命周期详解
    写文章很难,ai自动生成文章为你来排忧
    怎么用ai智能写作【智媒ai伪原创】快速写文章?
    给大家介绍个Seo伪原创工具吧,可以免费用的哈
    自媒体文章难写,在线伪原创文章生成就简单了
    内容创作难吗 不妨试试智媒ai伪原创
    Ai伪原创工具,轻松几秒出爆文
    什么AI写作软件靠谱,好用?
    分享个免费伪原创工具 关键词自动生成文章
  • 原文地址:https://www.cnblogs.com/cplusplus/p/3298631.html
Copyright © 2011-2022 走看看