8-3. 버튼 천안천일고등학교 류빈. 1. 가장 기본적인 위젯인 TextView 를 통해 위젯의 일반 적인 특징과 프로그래밍 방법을 상세하게 연구해보고 버튼의 사용 방법을 익힌다. 학습목표 1. 리소스 2. 텍스트 뷰 3. 버튼 학습내용 2.

Slides:



Advertisements
Similar presentations
Basic Functionality in Android. Functionality in Android Events in Java – mouse related mouse clicked button down or up mouse entered – many others key.
Advertisements

Android Form Elements. Views Provide common UI functionality Form elements: text area, button, radio button, checkbox, dropdown list, etc. Date and time.
@2011 Mihail L. Sichitiu1 Android Introduction Hello World.
Mobile Programming Lecture 2 Layouts, Widgets, Toasts, and Event Handling.
Android Tutorial Team 3 Jerry Yu Mayank Mandava Mu Du Will Wangles.
Wireless Mobility with Android 1 Presented by: Ung Yean MS. Computer Science American University, Washington DC, USA.
Package org.androidtown.database.query; import android.app.Activity; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase;
1 Mobile Computing Advanced Touching Copyright 2014 by Janson Industries Assg Part1Assg Part1 AssgPart2AssgPart2.
1 Announcements Homework #2 due Feb 7 at 1:30pm Submit the entire Eclipse project in Blackboard Please fill out the when2meets when your Project Manager.
로봇 전화번호부 4/4 UNIT 12 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 뷰 홀더 패턴을 사용할 수 있다. 토스트를 사용할 수 있다. 클릭 이벤트를 처리할 수 있다. 2.
2012 내장형 시스템 설계  Full Color LED 디바이스 구성  Full Color LED 디바이스 드라이버  Full Color LED JNI 라이브러리 작성  Full Color LED 안드로이드 App 구현  JNI 라이브러리.
1/29/ Android Programming: FrameLayout By Dr. Ramji M. Makwana Professor and Head, Computer Engineering Department A.D. Patel.
Programming with Android: Layouts, Widgets and Events Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
로봇을 조종하자 3/4 UNIT 17 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 스마트 폰의 센서를 사용할 수 있다. 2.
Cosc 5/4730 Basic GUI: Activities, fragments, and Views/Widgets.
Import import android.graphics.Bitmap; import android.widget.ImageView;
로봇 모션 편집기 4/4 UNIT 25 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 에디트 텍스트를 사용할 수 있다. 아이템을 삭제할 수 있다. 아이템을 편집할 수 있다. 2.
로봇 모니터링 1/2 UNIT 20 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Message Queue Handler 2.
1 Introducing Activity and Intent. 2 Memory LinearLayout, weight=2 LinearLayout, weight=1 TextView ListView.
Handling View Events. Open the *MainActivity.java* which is the Activity that hosts the layout in "activity_main.xml". The setContentView method inside.
Android Using Menus Notes are based on: The Busy Coder's Guide to Android Development by Mark L. Murphy Copyright © CommonsWare, LLC. ISBN:
4-3. 레이아웃 관리 천안천일고등학교 류빈 학습목표 학습내용 2 1. 리니어 이외의 기타 레이아웃을 배치하는 방법을 익힌 다. 2. 레이아웃을 관리하는 고급 기법에 대해 이해한다. 1. 렐러티브 레이아웃 2.Absolute 레이아웃 3.Frame.
로봇을 조종하자 4/4 UNIT 18 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Intent Activity 호출 2.
GUI Components 1 Fall 2012 CS2302: Programming Principles.
목차 한국기술교육대학교 강사: 김 영 준 ㈜헬로앱스 1일차 아두이노 제어 실습
Android and s Ken Nguyen Clayton state University 2012.
아주대학교 LifecareScienceLAB Android Seminar 3 rd class Android Software Development 2011/05/04 – p.m. 06:00 – 팔달관 409 호 아주대학교.
로봇을 조종하자 1/5 UNIT 14 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 터치 이벤트를 처리할 수 있다. 2.
Custom Widget 2 UNIT 27 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Custom Widget –Canvas 를 이용하여 Custom Widget 을 만든다. 2.
CHAP 14. 프로세스와 스레드. © 2012 생능출판사 All rights reserved 다중 스레딩 하나의 애플리케이션이 동시에 여러 가지 작업을 하 는 것 이들 작업은 스레드 (thread) 라고 불린다.
Android Alert Dialog. Alert Dialog Place Button to open the dialog. public class MainActivity extends ActionBarActivity { private static Button button_sbm;
CHAP 6. 이벤트 처리. © 2012 생능출판사 All rights reserved 폴링과 이벤트 구동 방식.
CHAP 7. 메뉴와 대화상자. © 2012 생능출판사 All rights reserved 메뉴의 종류 옵션 메뉴 : 사용자가 MENU 키를 누를 때 나타난다. 컨텍스트 메뉴 : 컨텍스트 메뉴는 사용자가 화면을 일정 시간 이상으로 길게 누르면 나타나는 메뉴이다.
Android 基本 I/O. 基本 I/O 介面元件 在此節中主要介紹常見的 I/O 使用者介 面元件 – Button, TextView, 以及 EditText , 學習者可以學會: – Android 的視窗表單設計 res/layout/main.xml – Android SDK –
Http :// developer. android. com / guide / topics / fundamentals. html.
You have to remember that  To create an AVD(Android Virtual Device)  The Structure of Android Project  XML Layout  The advantage of XML Layout  Android.
CHAP 8. 그래픽. © 2012 생능출판사 All rights reserved 안드로이드에서의 그래픽 XML 파일로 그래픽이나 애니메이션을 정의한다. 그 리는 작업은 안드로이드 시스템이 담당한다. onDraw() 메소드 안에 draw...() 와 같은 메소드를 호.
Lecture 3 Zablon Ochomo Android Layouts Lecture 3 Zablon Ochomo
Android Introduction Hello World
Android Layouts 8 May 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS 1.
Android N Amanquah.
UNIT 11 로봇 전화번호부 3/4 로봇 SW 콘텐츠 교육원 조용수.
GUI Programming Fundamentals
Android Introduction Hello World.
Android Notifications
Android Widgets 1 7 August 2018
Android Introduction Hello Views Part 1.
Picasso Revisted.
Android Introduction Hello Views Part 2.
CIS 470 Mobile App Development
Android Programming Lecture 6
CIS 470 Mobile App Development
CIS 470 Mobile App Development
CIS 470 Mobile App Development
Android Sensor Programming
CMPE419 Mobile Application Development
GUI Components.
UNIT 08 그림책 만들기 2/2 로봇 SW 콘텐츠 교육원 조용수.
BMI Android Application will take weight and height from the users to calculate Body Mass Index (BMI) with the information, whether user is underweight,
滑動 建國科技大學 資管系 饒瑞佶.
Programski jezici za mobilne aplikacije
CIS 470 Mobile App Development
CIS 470 Mobile App Development
Adding Components to Activity
BLP 4216 MOBİL UYGULAMA GELİŞTİRME-2
Lasalle-App Tecnología Móvil.
CIS 470 Mobile App Development
Android Sensor Programming
Android Sensor Programming
Android Sensor Programming
Presentation transcript:

8-3. 버튼 천안천일고등학교 류빈

1. 가장 기본적인 위젯인 TextView 를 통해 위젯의 일반 적인 특징과 프로그래밍 방법을 상세하게 연구해보고 버튼의 사용 방법을 익힌다. 학습목표 1. 리소스 2. 텍스트 뷰 3. 버튼 학습내용 2

3

4 C08_noninepatch.xml

5 나인 패치  나인 패치는 아홉 조각의 천을 잘라 하나의 무늬를 만드는 이불 제작 기겁 의 하나로 디지털 이미지에서 원리를 응용한 것이다.  나인 패치 이미지는 PNG 포맷이며. 9.png 를 지정하여 일반적인 이미지와 구분한다.  나인 패치는 이미지의 원래 모양 외에 바깥쪽에 1 픽셀 너비의 투명한 영역 을 추가로 가지며, 영역에 검정색 점을 찍어 확장 및 텍스트 배치 영역에 대 한 정보를 기록한다. 세로 내용물 영역 세로 확장 영역 가로 확장 영역 가로 내용물 영역

6  안드로이드에 포함된 draw9patch 유틸리티 사용. tools 디렉토리에 draw9patch.bat 파일을 실행하거나 tools/lib 폴더의 draw9patch.jar 파일을 바로 실행.

7 바깥쪽 테두리 1px 에 점을 찍거나 지운다.

8 마우스 왼쪽은 칠하게 되고 오른쪽은 지우게 된다.

9 C08_ninepatch.xml

10 public class Button extends TextView { public Button(Context context) { this(context, null); } public Button(Context context, AttributeSet attrs) { this(context, attrs, com.android.internal.R.attr.buttonStyle); } public Button(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } 안드로이드 표준 버튼은 처음은 회색, 클릭하면 주황색, 포커스가 있으면 빨간색, 사용금지이면 회색 버튼은 스타일만 다른 텍스트 뷰이며 스타일은 결국 속성의 집합이므로 속성만 다른 텍스트 뷰이다.

11 res/drawable/arrowback.xml 속성설명 state_active 활성 상태 state_checkable 체크 가능한 상태 state_checked 체크된 상태 state_enabled 사용 가능한 상태 state_focused 포커스를 받은 상태 state_pressed 눌려진 상태 state_selected 선택된 상태 state_window_focused 윈도우가 포커스를 가진 상태

12 c08_arrowbutton.xml c08_arrowbutton.java public class MainActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void mOnClick(View v) { switch (v.getId()) { case R.id.arrow1: Toast.makeText(this, "Arrow1 clicked", 0).show(); break; case R.id.arrow2: Toast.makeText(this, "Arrow2 clicked", 0).show(); break; case R.id.arrow3: Toast.makeText(this, "Arrow3 clicked", 0).show(); break; }

13 Button CompoundButton CheckBoxRadioButtonToggleButton

14

15 c08_radiocheck.xml <LinearLayout xmlns:android=" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <CheckBox android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Use Big Font" /> <RadioGroup android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <RadioButton android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Red" /> <RadioButton android:layout_width="fill_parent" c08_radiocheck.xml android:layout_height="wrap_content" android:text="Green" /> <RadioButton android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Blue" /> <ToggleButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ff0000" android:textOn=" 선택 " android:textOff=" 안선택 " android:textSize="20px" />

16 c08_radiocheck.java public class MainActivity extends Activity { private ToggleButton mTogBtn; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTogBtn = (ToggleButton)findViewById(R.id.MyToggle); RadioGroup ColGroup = (RadioGroup)findViewById(R.id.ColorGroup); ColGroup.setOnCheckedChangeListener(mRadioCheck); CheckBox chkBig = (CheckBox)findViewById(R.id.BigFont); chkBig.setOnCheckedChangeListener(mCheckChange); } RadioGroup.OnCheckedChangeListener mRadioCheck = new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (group.getId() == R.id.ColorGroup) { switch (checkedId) { case R.id.Red: mTogBtn.setTextColor(Color.RED); break; case R.id.Green: mTogBtn.setTextColor(Color.GREEN); break; case R.id.Blue: mTogBtn.setTextColor(Color.BLUE); break; }}}}; c08_radiocheck.java CompoundButton.OnCheckedChangeListener mCheckChange = new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged (CompoundButton buttonView, boolean isChecked) { if (buttonView.getId() == R.id.BigFont) { if (isChecked) { mTogBtn.setTextSize(40); } else { mTogBtn.setTextSize(20); }}}};}

17

C08_faketoast.xml <LinearLayout xmlns:android=" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="mOnClick" android:text=" 최신형 노트북을 반값에 드립니다.\n 다시 오지 않을 절호 의 찬수 \n 이번 기회를 놓치지 마세요 \n 노트북을 받고 싶은 분은 \n 이 버 튼을 눌러주세요 \n 감사합니다." /> C08_filtertouch.xml 18 토스트나 대화 상자가 해당 액티비 티위에 떠 있는 동안 터치 입력을 무시한다.

C08_filtertouch.java public class MainActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void mOnClick(View v){ switch (v.getId()){ case R.id.btnad: Toast.makeText(this, " 광고를 보았습니다.", 1).show(); break; case R.id.btncard: Toast.makeText(this, " 물품 대금을 카드 결재합니다.", 1).show(); break; case R.id.calltoast: LinearLayout linear = (LinearLayout)View.inflate(this, R.layout.c08_faketoast, null); Toast fake = new Toast(this); fake.setGravity(Gravity.LEFT|Gravity.TOP, 0, 20); fake.setDuration(Toast.LENGTH_LONG); fake.show(); break; } 19