728x90

T01.01-Exercise-CreateLayout 프로젝트를 열면

맨 아래 TODO 탭을 클릭해 보면 다음과 같이 보인다.

먼저

layout > activity_main.xml 을 수정한다

TODO(1)부터 순서대로 고쳐가면 되기 때문에


exercise code

solution code 

 

<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--TODO (1) Change the ConstraintLayout to a FrameLayout.
Note that you don't need to use the fully qualified name for FrameLayout. Replace
"android.support.constraint.ConstraintLayout" with "FrameLayout"-->
<!--TODO (6) Remove the line that declares the id, we don't need it-->
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent">

<!--TODO (2) Remove all attributes with the word constraint in them-->
<!--TODO (3) Remove the default text-->
<!--TODO (4) Give the TextView 16dp of padding-->
<!--TODO (5) Set the text size to 20sp-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="@+id/activity_main"
app:layout_constraintLeft_toLeftOf="@+id/activity_main"
app:layout_constraintRight_toRightOf="@+id/activity_main"
app:layout_constraintTop_toTopOf="@+id/activity_main" />

</android.support.constraint.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--COMPLETED (1) Change the ConstraintLayout to a FrameLayout-->
<!--COMPLETED (6) Remove the line that declares the id, we don't need it-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"
android:layout_height="match_parent">

<!--COMPLETED (2) Remove all attributes with the word constraint in them-->
<!--COMPLETED (3) Remove the default text-->
<!--COMPLETED (4) Give the TextView 16dp of padding-->
<!--COMPLETED (5) Set the text size to 20sp-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:textSize="20sp" />
</FrameLayout>

 

주석으로 된 TODO를 완료하면 COMPLETED로 바꿔주면 확인이 된다.


build.gradle 파일

: constraint-layout을 사용하지 않으므로 모듈을 사용한다는 정의는 제거(제거안해도 되지만 깔끔하게)

exercise

 solution

 

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion '25.0.2'

defaultConfig {
applicationId "com.android.example.favoritetoys"
minSdkVersion 10
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.1.0'

// TODO (7) Remove the ConstraintLayout dependency
// as we aren't using it for these simple projects
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
}
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion '25.0.2'

defaultConfig {
applicationId "com.android.example.favoritetoys"
minSdkVersion 10
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.1.0'
}

 


TODO를 모두 처리하고 App Build를 하면

다음과 같이 프로젝트 화면이 나온다. 별다른 특이점은 없다.

기본 layout을 framelayout으로 바꾼 것 뿐


Project Setup으로 나오는 것은 string.xml 에 app_name이 그리 되어있어서 임.


728x90
BLOG main image
"그게 뭐 어쨌다는 거냐?" 늘 누가 나에게 나에대한 말을할 때면 이말을 기억해라. by nobang

카테고리

nobang이야기 (1951)
Life With Gopro (7)
Life With Mini (79)
Diary (971)
너 그거 아니(do you know) (179)
난 그래 (159)
Study (290)
속지말자 (10)
Project (34)
Poem (15)
Song (0)
Photo (113)
낙서장 (45)
일정 (0)
C.A.P.i (2)
PodCast (0)
nobang (27)
고한친구들 (4)
recieve (0)
History (0)
android_app (2)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

Total :
Today : Yesterday :