Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 메소드
- 전화걸기
- 이클립스
- JavaScript
- 어노테이션
- HTML
- Android
- 메서드
- Graphic
- JSP
- 클래스
- Eclips
- mybatis
- 에러페이지
- 배열
- OGNL
- Menu
- paint
- layout
- 기본
- 생성자
- 예외처리
- oracle
- AWT
- 국제화
- struts2
- Java
- 안드로이드
- Spring
- 오버로딩
Archives
- Today
- Total
note
Android Frame Layout 본문
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/btn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Push Button" />
<ImageView
android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/pride"
/>
</FrameLayout>
package kr.android.layout8;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class FrameLayoutDemo extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//이벤트 소스
Button btn = (Button)findViewById(R.id.btn);
//익명 내부 클래스 형태의 이벤트 처리
btn.setOnClickListener(new Button.OnClickListener(){
//이벤트 핸들러
public void onClick(View v){
ImageView img = (ImageView)findViewById(R.id.img);
//View.VISIBLE : 보여짐
//View.INVISIBLE : 안보여짐
//View.GONE : 안보여지면서 해당 위치에서 제거
if(img.getVisibility() == View.VISIBLE){
img.setVisibility(View.INVISIBLE);
}else{
img.setVisibility(View.VISIBLE);
}
}
});
}
}
'Android > 기본' 카테고리의 다른 글
| ListActivity ArrayAdapter (0) | 2012.01.09 |
|---|---|
| Android Table Layout (0) | 2012.01.06 |
| Android Relative Layout (0) | 2012.01.06 |
| Android Margin Padding (0) | 2012.01.06 |
| Android LinearLayout 가중치 (0) | 2012.01.06 |