1. [과제] Facebook ERD 만들기
URL : https://aquerytool.com:443/aquerymain/index/?rurl=7b792ade-b7e3-4686-8c54-7e004f75f9ff
비밀번호 : 72ny3l
[오늘부터 안드로이드 시작..!!]
1. 구글 개발자 등록하기(한번만 등록하면 됨, 대신 25불 결제해야함)
: 구글에 Google Developer Console 검색 > 로그인하기
> 동의 체크 박스에 체크 > 결제 페이지로 이동 클릭
> 결제 정보 입력 후 구매 버튼 클릭 > 정상적으로 결제되면 결제 완료 팝업 창 뜸 > 등록 계속하기 클릭
> 개발자 프로필 작성 후 개발자 계정 ID 메모해두기
> 정상적으로 구글 개발자 등록 완...!!
2. Android Studio
: 구글에서 인텔리제이(IntelliJ) 기반으로 만든 IDE
[이번 수업에서 사용할 버전] 안드로이드 플러그인 3.6.2 for Windows 64-bit 버전,
안드로이드 스튜디오 Android 10.0버전의 API 29레벨,
안드로이드 스튜디오 Pie 9.0의 API 28레벨을 사용할 예정
** SDK : Software Developmenet Kit (소프트웨어 개발을 위한 제반의 프로그램들의 집합)
** API : Application Programming Interface
** AVD : Android Virtual Device
3. Android Studio 설치
: 구글에 android studio 검색 > Download Android Studio and SDK tools ... 클릭
> DOWNLOAD ANDROID STUDIO 클릭(3.6.2 for Windows 64bit)
> 라이센스 동의 > 다운로드 클릭 > 응용 프로그램 실행
> Next 클릭
> Android Studio 선택 되어 있는 거 확인하고 Install 클릭 > Install을 다하고 나면 Next 활성화됨 > Next 클릭
> Finish 클릭 > Do not import settings 선택 후 OK 클릭
> 구글 정보 제공 동의 팝업 창 뜸, 무조건 동의할 필요 없음, Don't send 클릭
> Next 클릭 > 일반적으로는 'Standard' 설치로 진행하면 되나 Custom으로 설치하는 이유는
어떠한 것들이 세팅되는지 확인하기 위해서 선택 > Next 클릭
> 원하는 테마 선택 후 Next 클릭 > [SDK 세팅] Android Virtual Device 무조건 체크 박스 선택!!
> Android SDK Location 경로 선택 후 Next 클릭 > [Emulator 세팅] 권장세팅으로 진행, Next 클릭
> Finish 클릭 > show Details 클릭하면 현재 다운로드 상황을 상세하게 볼 수 있음
> 다운로드 다 되면 Finish가 활성화 됨 > Finish 클릭
> 다운로드 완..!!
4. Android Studio 세팅
1) Check for Updates(IDE and Plugin Updates)
: 수동으로 업데이트를 확인
** Configure > Check for Updates 클릭 > Update 가능한 목록 보여짐 > 체크 후 Update 클릭
> 만약 업데이트할 것이 없으면 아래의 사진처럼 확인됨
2) SDK Manager(Settings for New Projects)
: 도구 업데이트(앱 개발에 필요한 SDK 도구, 플랫폼 및 기타 구성요소를 다운)
** Configure > SDK Manager 클릭
> SDK Platforms은 아래의 표시대로 다운
> SDK Tools은 최신 버전으로(Android 10.0 버전 API는 29레벨, 29레벨에서 가장 최신 버전으로 다운받기)
> 각각 항목에 대해 Accept 선택 하면 Next 버튼 활성화 > Next 클릭
> 선택한 항목 다운로드 > 다운로드 다되면 Finish 버튼 활성화 > Finish 버튼 클릭
3) Settings(Settings for New Projects)
: 안드로이드 스튜디오를 킬 때 마지막에 작업했던 프로젝트가 열리는 것이 아니라 선택할 수 있도록 세팅
** Configure > Settings 클릭 > System Settings > Reopen last project on startup 체크 해제
5. 안드로이드 버전 점유율 확인(Apple iOS에 비해 OS fragmentation이 심함)
http://developer.android.com/about/dashboards/index.html#Platform
6. 안드로이드 시스템 구성(Android Architecture)
System Applications : 응용프로그램(앱)
Application Framework(Java API) : 개발자는 이것을 이용하여 앱 개발
Libraries(native c/c++), Android Runtime : 자바가상머신 ART(구 Dalvik)
Hardware Abstraction Layer(HAL) : 제조사 H/W와 Android 연결 역할
Linux Kernel : 안드로이드 커널은 리눅스
7. 새 프로젝트 만들기
: Start a new Android Studio Project 클릭 > Phone and Tablet > Empty Activity > Next 클릭
> Name은 AndroidWork로 작성 > 자동으로 package name, Save location 설정되기 때문에 따로 설정할 필요 없음
> Language는 java 선택 > Minimum은 이전 단말기 중 어느 버전의 기기까지 지원할지 설정하는 것,
API21: Android 5.0(Lollipop)으로 설정 > Finish 클릭
> 프로젝트 완성..!!
8. 글꼴 크게 설정하기
: File > Settings... > Editor > Font > 원하는 Size 설정 후 > Apply 클릭 후 OK
9. Design 모드로 변경
: activity_main.xml 클릭
> 파란색 네모 두개 그려져 있는거 클릭 > Design 클릭
10. AVD(Android Virtual Device) 세팅
: 핸드폰과 안드로이드 그림 그려져 있는 아이콘 클릭
> Your Virtual Devices 창 열림 > 기존에 등록되어 있는 Devices 삭제
> Create Virtual Device ... 클릭
> Phone, Pixel 2 선택 후 Next 클릭
> Android 10.0 버전, API 29레벨 선택 후 Next
> Finish 클릭
> 초록색 시작 버튼 누르면 AVD 가동됨
> 실제로 가동된 모습
11. 앱 실행
: Run 'App' (Shift + F10) 클릭
> Hello World! 앱 실행됨...!!
12. 모듈 생성하기
: res > layout 선택 후 우클릭 > New > Layout Resource File 클릭
> File name 원하는 이름 작성 후 Root element는 LinearLayout 작성 > OK 클릭
13. 모듈 이름 변경
: 변경하고자 하는 모듈 선택 > 단축키 Shift + F6
> Enter new module name에 변경하고자 하는 이름 기입 후 OK 클릭
14. Activity 생성
: 우클릭 > New > Activity > Empty Activity 클릭
> Activity Name에 원하는 이름 기재,
Layout Name에 기존에 만든 Layout 이름 기재하고 Lancher Activity 체크하면
자동으로 onCreate에 생성됨과 동시에 Activity 생성 완...!!
> manifests를 보면 내가 만든 Main2Activity를 확인할 수 있음..!!
15. 스크린 위에 액티비티가 깔리고 액티비티 위에 뷰가 깔린다..!!
** 액티비티(Activity)란? 안드로이드의 각 화면
** 뷰(View)란? 안드로이드의 사용자 인터페이스의 모든 요소이며
위젯(Widget) 혹은 콤포넌트(Component)라고도 불림
16. Android 뷰 : 모듈 및 파일 형식별로 프로젝트 파일/폴더를 분류
** 해당 모듈 정보를 볼 수 있음..!!
[실습코드]
** XML(eXtensible Markup Language)은 웹에서 사용하던 HTML에서 확장된 형태의 포맷
** XML(eXtensible Markup Language)은 데이터를 표현하는데 주로 사용
** XML(eXtensible Markup Language)은 HTML 보다 좀더 까다로운 규칙, namespace 등 적용 가능
** XML은 HTML과 달리 태그 대소문자를 구분한다
** 실습때 사용한 레이아웃, 위젯, 속성
레이아웃 - LinearLayout(리니어 레이아웃)
기본위젯 - TextView, Button, ImageView, ToggleButton
기본속성 - layout_width, layout_height, text, layout_margin, layout_padding, textColor, background,
layout_weight, gravity, layout_gravity ... 등
1. a001_hello 모듈
1) my_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/ediText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Name"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="246dp"
app:srcCompat="@android:drawable/btn_star_big_on" />
</LinearLayout>
package com.example.androidwork;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.my_layout);
}
}
2) activity_main2.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView" />
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Switch
android:id="@+id/switch1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Switch" />
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
package com.example.androidwork;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
}
}
2. a002_layout 모듈
1) activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="#C8B617" />
package com.example.a002_layout;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
2) linear1.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#7EBD33"
android:text="첫번째 TextView"
android:textColor="#000000"
android:textSize="30sp"/>
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:layout_margin="10dp" />
<!-- element 사이에는 주석 가능하나 element 안에는 주석 불가능함 -->
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="버튼 A" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#16D2EA"
android:text="TextView"
android:padding="10dp"
android:textColor="#B6401B" />
</LinearLayout>
package com.example.a002_layout;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.linear1);
}
}
3) linear2.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="100dp"
android:text="버튼1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="버튼2" />
<Button
android:layout_width="match_parent"
android:layout_height="100dp"
android:text="버튼3" />
</LinearLayout>
package com.example.a002_layout;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.linear2);
}
}
4) linear3.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Layout 안에 Layout 을 만들 수 있음 -->
<!--id attribute 는 중복되면 안됨-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="LinearLayout3"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="버튼1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="버튼2" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="버튼3" />
</LinearLayout>
<ToggleButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ToggleButton" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<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="Button" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="이름"
android:layout_margin="5dp"
android:background="#BDB038"
android:gravity="center" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textPersonName"
android:hint="이름을 입력해주세요." />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="나이"
android:layout_margin="5dp"
android:background="#CDDC39"
android:gravity="center" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="number"
android:hint="나이를 입력해주세요." />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="이메일"
android:layout_margin="5dp"
android:background="#E69D30"
android:gravity="center" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="textEmailAddress"
android:hint="이메일을 입력해주세요." />
</LinearLayout>
</LinearLayout>
package com.example.a002_layout;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.linear3);
}
}
5) linear4.xml
** gravity : content 정렬
** layout_gravity : 위젯 정렬
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="LayoutGravity"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#4CAF50"
android:text="Button" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#4CAF50"
android:text="Button" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="#4CAF50"
android:text="Button" />
<TextView
android:id="@+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Gravity"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />
<Button
android:id="@+id/button4"
android:layout_width="match_parent"
android:layout_height="107dp"
android:gravity="left"
android:text="Button" />
<Button
android:id="@+id/button5"
android:layout_width="match_parent"
android:layout_height="58dp"
android:gravity="center|top"
android:text="Button" />
<Button
android:id="@+id/button6"
android:layout_width="match_parent"
android:layout_height="143dp"
android:gravity="bottom|right"
android:text="Button" />
</LinearLayout>
'웹_프론트_백엔드 > JAVA프레임윅기반_풀스택' 카테고리의 다른 글
2020.04.16 (0) | 2020.04.16 |
---|---|
2020.04.14 (0) | 2020.04.14 |
2020.04.10 (0) | 2020.04.10 |
2020.04.09 (0) | 2020.04.09 |
2020.04.08 (0) | 2020.04.08 |