안드로이드에서의 padding / layout_margin 속성

Posted by Albert 4797Day 13Hour 2Min 8Sec ago [2012-03-01]

css에서 margin / padding 으로 텍스트 혹인 이미지 상하좌우 공백여부를 

조절할수있는것처럼 안드로이드에서도 비슷한 기능을 제공한다.

그것이 바로 padding 과 layout_margin 속성이다. 

html과 개념이 같다고 저는 생각하고 간단한 테스트 코드를 작성해봤당. ^^

20120301225105.gif (417×299)

===================================================================

소스코드

===================================================================

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    android:orientation="horizontal"

    android:baselineAligned="true" >


   

        android:id="@+id/text01"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:gravity="right|bottom"

        android:text="큰글씨" 

        android:textColor="'ffff0000"

        android:textSize="32dp"/>

    

   

        android:id="@+id/text02"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:text="중간 글씨" 

        android:textColor="'ff00ff00"

        android:textSize="22dp"/>

    

   

        android:id="@+id/button03"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:text="작은 글씨" 

        android:textColor="'ff0000ff"

        android:textSize="12dp"/>




LIST

Copyright © 2014 visionboy.me All Right Reserved.