1) AVD μ ν€ν¨λμ λͺ μΉμ μ 리νμμ€.
AVD μ κΈ°λ³Έ λͺ μΉλ€
2) λ€μ κ° νλͺ©μ λ¨μΆν€λ 무μμΈκ°?
- AVD μλ¨μ νμ μμ΄μ½ : AVD νλ©΄μ κ°λ‘ λ° μΈλ‘λ‘ λ³κ²½
- Ctrl + SpaceBar : XML λλ JAVA μ½λμ μλ μμ±
- ctrl + /
- ctrl + shift + / : μ νλ μμμ μ£Όμ
- Alt + Enter : ν΄λμ€ μΈν°νμ΄μ€ μλ μν¬νΈ
- Ctrl + Alt + L : μμ€μ½λ μ λ ¬
3) μλλ‘μ΄λ νλ‘κ·Έλλ°μ νλ€ λ³΄λ©΄ μ½λ©μ μ€λ₯μ κ²½κ³ κ° λ°μνλ€. μ΄ λκ°μ§μ λν΄ μ€λͺ νμμ€
μ€λ₯ : μλΉν λ€μν κ²½μ°κ° μκΈ° λλ¬Έμ μ΄λ€ λ¬Έμ μΈμ§ μμνκΈ° μ΄λ ΅λ€.
κ²½κ³
4) νλ‘μ νΈμμ μ¬μ©νλ 리μμ€κ° μ μ₯λλ /res ν΄λ μλμ νμ ν΄λμ νμΌμ μ©λλ₯Ό μ€λͺ νμμ€
res > μ΄λ―Έμ§ λ μ΄μμ λ¬Έμμ΄ λ±μ΄ λ€μ΄κ°λ ν΄λ
- drawble > μ΄λ―Έμ§ νμΌ
- layout > xml νμΌ
- mipmap > λμμΈ νλ©΄, λ°μΉ μμ΄μ½
- values > λ¬Έμμ΄ , μμν, μ€νμΌ xml
- menu > λ©λ΄ xml (νμνλ©΄ μμ±ν΄μ μ¬μ©)
- anim μ λλ©μ΄μ , xml κΈ°ν λ±λ±
5) μμ±λ μ±μ΄ μμ΄μ€ν¬λ¦Ό μλμμΉ (4.0.x) μ΄μμ μ€λ§νΈν°μμ λͺ¨λ μλνκ² νλ €λ©΄ 무μμ κ³ λ €ν΄μΌνλ©° νλ‘μ νΈλ₯Ό μ΄λ»κ² μμ±ν΄μΌνλκ°?
νλ‘μ νΈ μμ±μ Minimum SDK λ₯Ό μμ΄μ€ν¬λ¦Ό μλμμΉλ‘ μ§μ νλ©΄
κ·Έ μ΄μμ λ²μ μμλ λͺ¨λ μλνλ€.
6) λ²νΌμμ μ¬μ© κ°λ₯ν Xml μμ±μλ μ΄λ€ κ²μ΄ μλμ§ μ‘°μ¬νμμ€.
https://developer.android.com/guide/topics/ui/controls/button?hl=ko
7) λ€μ νλ©΄μ λμμΈνκ³ JAVA μ½λλ₯Ό μμ±νμμ€
drawble >
// νμΌλͺ
μ μλ¬Έμλ‘ ν΄μ€μΌνλ€.
img1.jpg
img2.jpg
MainActivity.java >
package com.example.myapplication0101;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
EditText edit1;
Button btn1, btn2;
RadioGroup grp;
RadioButton rbtn1, rbtn2;
ImageView img1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
edit1 = findViewById(R.id.edit1);
btn1 = findViewById(R.id.btn1);
btn2 = findViewById(R.id.btn2);
rbtn1 = findViewById(R.id.rbtn1);
rbtn2 = findViewById(R.id.rbtn2);
img1 = findViewById(R.id.img1);
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(),edit1.getText().toString(),Toast.LENGTH_SHORT).show();
}
});
btn2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri uri = Uri.parse(edit1.getText().toString());
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
rbtn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
img1.setImageResource(R.drawable.img1);
}
});
rbtn2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
img1.setImageResource(R.drawable.img2);
}
});
}
}
activity_main.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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical"
android:layout_margin="15dp">
<EditText
android:id="@+id/edit1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btn1"
android:text="κΈμ λνλ΄κΈ°"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btn2"
android:text="ννμ΄μ§ μ΄κΈ°"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RadioGroup
android:id="@+id/grp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/rbtn1"
android:text="11.0(R)"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RadioButton
android:id="@+id/rbtn2"
android:text="12.0(S)"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RadioGroup>
<ImageView
android:id="@+id/img1"
android:src="@drawable/img1"
android:layout_margin="30dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>