프로그래밍

Hello World

Dilrong 2017. 11. 9. 23:35



MainActivity.java

package com.incheon.our.ch03a;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tv = (TextView)findViewById(R.id.textView);
tv.setText("Java Code Text View\n Hello World!");
}
}



string.xml

<resources>
<string name="app_name">ch03a</string>
<string name="hello">Hello, World!</string>
</resources>



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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="TextView" />
</LinearLayout>





개발환경 : Android Studio 2.3.3

언어 : JAVA

ch03a.z01

ch03a.z02

ch03a.zip



반응형

'프로그래밍' 카테고리의 다른 글

이벤트처리  (0) 2017.11.09
Layout  (0) 2017.11.09
WinForm을 이용한 가위바위보  (0) 2017.11.09
비트연산자 이용한 swap  (0) 2017.11.09
VRProject 3차  (0) 2017.08.22