1. AS / project / app / layout / activity_main.xml

2. new xml

3. 레이아웃

  • LinearLayout
  • RelativeLayout
  • FrameLayout
  • ScrollView

 

<화면전환 예제> - 출처:안드로이드 앱프로그래밍 9.0 p235

new project "myapplication1002"

res / new / layout - new "sub1.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="부분 화면 1"
        android:textSize="30sp" />

    <CheckBox
        android:id="@+id/checkBox"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="동의합니다"
        android:textSize="30sp" />
</LinearLayout>

 

new activity_menu.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="vertical">
    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="버튼을 눌러 부분 화면을 추가하세요"
        android:textSize="20sp" />

    <Button
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="추가하기" />
    <LinearLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

    </LinearLayout>

</LinearLayout>

 

edit app/ AndroidManifest.xml

 

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapplication1002">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".MenuActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>

</manifest>

 

new menuActivity.java

 

package com.example.myapplication1002;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.LinearLayout;

public class MainActivity extends AppCompatActivity {
    LinearLayout container;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_menu);

        container = findViewById(R.id.container);

        Button button = findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View view) {
                LayoutInflater inflater = (LayoutInflater)
                        getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                inflater.inflate(R.layout.sub1,container,true);
                CheckBox checkBox = container.findViewById(R.id.checkBox);
                checkBox.setText("로딩되었어");
            }
        });
    }
}

왜 FIREBASE 인가? 빠른 개발에 유리.

 

firebase.google.com/docs/android/setup

 

Android 프로젝트에 Firebase 추가

기본 요건 Android 스튜디오를 설치하거나 최신 버전으로 업데이트합니다. Android 앱이 다음을 충족하는지 확인합니다. API 수준 16(Jelly Bean) 이상 타겟팅 Gradle 4.1 이상 사용 앱을 실행할 기기 또는 ��

firebase.google.com

1. AS project 생성 

2. FB project 생성시 앱 패키지이름 입력(=안드로이드프로젝트명) > google~.json 다운로드 후

3. AS 프로젝트 root 폴더로 복사 > build.gradle 확인(app수준 plugin imple / project수준 buildscript reposit)

    (다른방법 AS에서 tools/firebase assistant에서 auth - connect)

4. FB 콘솔에서 authenticaiton 로그인 사용설정

 

firebase.google.com/docs/auth/android/start/

 

Android에서 Firebase 인증 시작하기

Firebase에 앱 연결 Android 프로젝트에 Firebase를 추가하지 않았다면 먼저 추가합니다. 프로젝트 수준 build.gradle 파일의 buildscript 및 allprojects 섹션에 Google의 Maven 저장소가 포함되어야 합니다. 앱에 Fir

firebase.google.com

 

 

ANDROID STUDIO 

  • project
  • package
  • Gradle project / module:app 

FIREBASE (FB)

  • project

github.com/firebase/quickstart-android

 

firebase/quickstart-android

Firebase Quickstart Samples for Android. Contribute to firebase/quickstart-android development by creating an account on GitHub.

github.com

 

+ new empty Activity + new project

 

1. 시작 + start Project (App name) => res/values/strings.xml 

 

2. 구성 색상 변경하기 => res/values/colors.xml

 

3. 앱 화면구성하기 => res/layout/activity_main.xml

 

4. 프로젝트 구성

  • app / AndroidManifests (앱정보)
  • app / java (코딩)
  • app / res (리소스폴더  레이아웃,values,drawable 등)
  • Gradle scripts (배포)

5. App/Java/MainActivity.java

  • package
  • import
  • public class MainActivity extends AppCompatActivity
  • onCreate()
  • setContentView()

'정보영재 > ANDROID' 카테고리의 다른 글

안드로이드 XML 화면구성하기  (0) 2020.10.01
ANDROID -firebase와 연결하기  (0) 2020.10.01
Android - 안드로이드 스튜디오 설치  (0) 2020.09.30

1. 설치 프로그램 다운로드 

 

Android 개발자  |  Android Developers

Android 앱 개발자를 위한 공식 사이트입니다. Android SDK 도구 및 API 문서를 제공합니다.

developer.android.com

  • setup wizard 에서 SDK포함하여 finish하여 설치

 

2. 프로그램 실행

  • start N project > empty activity > (App Name 이름입력, 언어 JAVA)

 

3. 가상단말기 실행

  • Tools > AVD manager (Android virtual device)> create

 

4. 자바 환경변수 설정 

  • 내PC > 속성(고급) > new 사용자변수 ( jdk폴더까지의 new사용자변수 추가 후, PATH 클릭하여 추가  %new사용자변수명%bin)
  • cmd > javac 확인, 어디에서나 자바실행 가능하도록 설정

 

 

+ Recent posts