어제 설치했던 지니모션을 실행해주세요.
스타트를 클릭합니다.
실행 모습
안드로이드 스튜디오를 실행하고 File > Close Project를 클릭해주세요.
Start를 클릭합니다.
name : HelloWorld_5
domain : a.android.org
location : C:\android.314\HelloWorld_5
next를 클릭해주세요.
main을 지우고 HelloWorld_5를 넣어주시고 Finish를 클릭해주세요.
재생 버튼을 클릭하시거나 Shift + F10을 눌러주세요.
ok를 클릭해서 실행합니다.
지니모션에 화면이 제대로 출력 되는지 확인합니다.
1. 폰트 크기 바꾸기
File > New > New Project 클릭
name : TextView_2
domain : soldesk.android.org
location : C:\android.314\TextView_2
메인을 지우고 TextView_2를 넣어주고 Finish를 클릭하세요.
xml을 클릭합니다.
Text를 클릭해주세요.
기존 내용을 지우고 위와 같이 셋팅해줍니다.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.android.soldesk.textview_2.TextView_2Activity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView02"
android:text="아름다운 사람(Normal Size)"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView01"
android:layout_alignParentLeft="true"
android:layout_below="@id/textView02"
android:layout_marginTop="20dp"
android:text="Hello(Large Size)"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView03"
android:layout_alignParentLeft="true"
android:layout_below="@id/textView01"
android:layout_marginTop="17dp"
android:text="Hello(Medium Size)"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView04"
android:layout_alignParentLeft="true"
android:layout_below="@id/textView03"
android:layout_marginTop="23dp"
android:text="Hello(Small Size)"
android:textAppearance="?android:attr/textAppearanceSmall"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView05"
android:layout_alignParentLeft="true"
android:layout_below="@id/textView04"
android:layout_marginTop="20dp"
android:text="ldm"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
</RelativeLayout>
<실행 모습>
2. 이미지 삽입
마찬가지로 New Project를 실행합니다.
이름은 TextView_03으로 설정해주시고 Activity Name에 main을 지우고 TextView_03을 넣고 Finish를 클릭합니다.
인터넷에서 적당한 크기에 이미지들을 다운로드 받습니다. 저는 200 x 300, 100 x 150, 100 x 150 이렇게 받았습니다.
이미지를 복사합니다.
Android > res > drawable > Paste를 클릭해서 복사한 이미지들을 넣습니다. 이미지 이름은 aaa, bbb, ccc로 하였습니다.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.android.soldesk.textview_03.TextView_03Activity">
<TextView
android:id="@+id/textView01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#3300ff00"
android:text="아름다운 가을 날씨 ~~~~~~"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorAccent" />
<ImageView
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/aaa"
/>
<ImageView
android:layout_marginTop="330dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bbb"
/>
<ImageView
android:layout_marginLeft="100dp"
android:layout_marginTop="330dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ccc"
/>
</RelativeLayout>
3. 라이프 사이클 [life cycle] 테스트
New Project를 실행 > 이름 Android_Lifecycle_1 설정 > 메인을 지우고 Android_Lifecycle_1 넣고 Finish
하단에 Android Monitor 클릭
Edit Filter Configuration 클릭
Name : SBS
Tag : YourTag
Level : Debug
ok 클릭
Debug 클릭
java 선택 후 아래 코드를 입력하고 실행해주세요.
package org.android.soldesk.android_lifecycle_1;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
public class Android_Lifecycle_1Activity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_android__lifecycle_1);
Log.d("YourTag", "onCreate >>>");
}
protected void onDestroy()
{
super.onDestroy();
Log.d("YourTag","onDestroy >>>");
}
protected void onPause()
{
super.onPause();
Log.d("YourTag","onPause >>>");
}
protected void onRestart()
{
super.onRestart();
Log.d("YourTag","onRestart >>>");
}
protected void onResume()
{
super.onResume();
Log.d("YourTag","onResume >>>");
}
protected void onStart()
{
super.onStart();
Log.d("YourTag","onStart >>>");
}
protected void onStop()
{
super.onStop();
Log.d("YourTag","onStop >>>");
}
}
실행 후 라이프 사이클 확인이 가능해짐
5. 텍스트뷰(TextView)
New Project를 실행 > 이름 TextView_03 설정 > 메인을 지우고 TextView_03 넣고 Finish
Text에 아래 소스 입력
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.android.soldesk.textview_03.TextView_03Activity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView01"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="18dp"
android:text="http://google.com"
android:autoLink="web"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView02"
android:layout_alignParentLeft="true"
android:layout_below="@id/textView01"
android:layout_marginTop="18dp"
android:text="010-3456-5678"
android:autoLink="phone"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView03"
android:layout_alignParentLeft="true"
android:layout_below="@id/textView02"
android:layout_marginTop="18dp"
android:text="http://google.com"
android:autoLink="all"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
</RelativeLayout>
링크를 클릭하면 이동함
visibility
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.android.soldesk.textview_04.TextView_04Activity">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView01"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="OneOne"
android:background="#880000ff"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView02"
android:layout_alignParentLeft="true"
android:layout_below="@id/textView01"
android:text="Two~~~~~"
android:background="#88dd00ff"
android:textAppearance="?android:attr/textAppearanceLarge"
android:visibility="invisible"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView03"
android:layout_alignParentLeft="true"
android:layout_below="@id/textView02"
android:text="Three~~~~"
android:background="#88447777"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
</RelativeLayout>
EditText_01
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.android.soldesk.edittext_01.EditText_01Activity">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/editText01"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:ems="10"
android:hint="아이디를 입력하세요"
android:inputType="text"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/editText02"
android:layout_alignParentLeft="true"
android:layout_below="@id/editText01"
android:ems="10"
android:hint="이메일을 입력하세요"
android:inputType="textEmailAddress"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/editText03"
android:layout_alignParentLeft="true"
android:layout_below="@id/editText02"
android:ems="10"
android:hint="전화번호를 입력하세요"
android:inputType="phone"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/editText04"
android:layout_alignParentLeft="true"
android:layout_below="@id/editText03"
android:ems="10"
android:hint="급여를 입력하세요"
android:inputType="number">
<requestFocus/>
</EditText>
</RelativeLayout>
'안드로이드(Android)' 카테고리의 다른 글
6. 스크롤뷰(ScrollView), 스피너(spinner), 이미지 주소 삽입, 리스트뷰(ListView) (0) | 2017.03.21 |
---|---|
5. 이미지뷰(ImageView), 스위치(Switch), 체크박스(CheckBox), 라디오버튼(RadioButton) (0) | 2017.03.20 |
4. Margin_Padding, Checkbox(체크박스), Layout(레이아웃), Toggle(토글), radioButton(라디오버튼) (0) | 2017.03.17 |
3. 버튼(Button) (0) | 2017.03.16 |
1. Android Studio(안드로이드 스튜디오) 설치, genymotion(지니모션) 설치 (0) | 2017.03.14 |