Android/2012.04월 강좌
2일차 기본3
Bohemian life
2012. 4. 27. 12:34
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@drawable/dolly"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <TextView android:layout_width="320px" android:layout_height="wrap_content" android:background="#ff0000" android:text="TextView" > <!-- 16*16=256 RGB #RRGGBB --> </TextView> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="버튼" > </Button> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="버튼2" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" android:background="#77ff0000" ></ImageView> <ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" android:background="#7799aa"/> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" android:src="@drawable/ic_launcher" android:background="@drawable/dolly"/> <!-- scaleType nothing : default 뷰 크기에 맞게 확대 matix : 원본사이즈 그대로 fixXY : 뷰 크기에 맞게 늘리거나 줄이기 center : 가운데배치 크기 그대로 가기 centerCrop : 가운데 배치 비율을 확대 축소 + 남는 부분 crop --> </LinearLayout>
package com.sogangori; import android.app.Activity; import android.os.Bundle; public class HelloWorldActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //-----------xml-------------- setContentView(R.layout.main); } }