안드로이드 버튼과 레이아웃에 배경 설정하기

2018. 1. 17. 19:40 안드로이드/레이아웃(Layout)

버튼과 레이아웃에 배경 설정하기.

 

① 색상 형식.

- AA : 투명도, 00~FF, 00-투명, FF-불투명.

- RR : 적색, 00~FF

- GG :녹색, 00~FF

- BB : 청색, 00~FF

 

색상 형식

#AARRGGBB

#RRGGBB

#RGB

 

main.xml

<?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:background="@drawable/image1"

>

<Button

android:layout_width="fill_parent"

android:layout_height="100px"

android:text="Button Button Button Button"

android:background="#ffff0000"

/>

<View

android:layout_width="fill_parent"

android:layout_height="30px" />

<Button

android:layout_width="fill_parent"

android:layout_height="100px"

android:text="Button Button Button Button"

android:background="#aaff0000"

/>

<View

android:layout_width="fill_parent"

android:layout_height="30px" />

<Button

android:layout_width="fill_parent"

android:layout_height="100px"

android:text="Button Button Button Button"

android:background="#00ff0000"

/>

<View

android:layout_width="fill_parent"

android:layout_height="30px" />

<Button

android:layout_width="fill_parent"

android:layout_height="100px"

android:text="Button Button Button Button"

android:background="#0000ff"

/>

<View

android:layout_width="fill_parent"

android:layout_height="30px" />

<Button

android:layout_width="fill_parent"

android:layout_height="100px"

android:text="Button Button Button Button"

android:background="#0F0"

/>

</LinearLayout>

 




출처 : http://blog.naver.com/shylove2456/150110240791