본문 바로가기

나 어제 배웠다/Android

Android 모양구성-LinearLayout

▣ 모양 구성

1. layout[배치] - extends ViewGroup

 (m) File > New > Other > Android > Android Project

소스변경

LayoutTest > src > soo.ui.layout

 

package soo.ui.layout;

import android.app.Activity;
import android.os.Bundle;

public class LayoutTestActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);
       
        setContentView(R.layout.linearlayout_test);      //XML File 생성
    }
}

 

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="#FFFF00">
 
  <TextView
     android:id="@+id/TextView01"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:text="레이아웃 리니어"
     android:textSize="12pt"
     android:gravity="center"
     android:background="#FF0000"
     android:layout_weight="1"/>
    
  <LinearLayout
     android:orientation="horizontal"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:layout_weight="1">
   <Button
      android:id="@+id/Button01"
      android:layout_width="fill_parent"
      android:text="버튼1"
      android:layout_height="fill_parent"
      android:layout_weight="1"/>
   <Button
      android:id="@+id/Button02"
      android:layout_width="fill_parent"
      android:text="버튼2"
      android:layout_height="fill_parent"
      android:layout_weight="1"/>
   <Button
      android:id="@+id/Button03"
      android:layout_width="fill_parent"
      android:text="버튼3"
      android:layout_height="fill_parent"
      android:layout_weight="1"/>
  </LinearLayout>
    
  <EditText  
     android:id="@+id/EditText01"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:hint="content"
     android:layout_weight="1"/>  
  <GridView
     android:id="@+id/GridView01"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:layout_weight="1"/> 
</LinearLayout>

실행

 (m) Run > Run As > Android Application

 

2. widget[컴포넌트]

- extends View

3. dialog

 

▣ 이벤트처리

 

▣ 실행환경측면에서의 메커니즘 구성요소

 

▣ File I/O, Socket, Sqlite

 

▣ Google Service

 

▣ 멀티미디어