'안드로이드 앱 만들기'에 해당되는 글 43건

  1. 2020.07.28 EditText & Button
  2. 2020.07.25 Text View 만들기
  3. 2020.07.25 안드로이드 개발자 모드(USB 디버깅) 설정방법

Edit Text - 사용자가 텍스트를 입력하거나 수정할 수 있도록 하는 사용자 인터페이스 컨트롤

in put Text - 텍스트를 입력할 수 있는 필드

onCreate - 어플을 실행 했을때 처음으로 실행됨

find View By id - 특정 아이디를 특정 코드에 속성을 부여하라는 뜻

 

xml 파일은 화면을 구성하는 요소

dp는 길이 개념

 

activity_main.xml

---------------------------------------

<?xml version="1.0" encoding="utf-8"?>

 

      xmls:app="http://schemas.android.com/apk/res-auto"

      xmls:tools="http://schemas.android.com/tools"

      android:layout_width="match_parent"

      android:layout_height="match_parent"

      android:orientation="vertical"

      tools:context=".MainActivity">

 

      <EditText

           android:id="@+id/khon_id"

           android:layout_width="300dp"

           android:layout_height="wrap_content"

           android:hint="아이디를 입력하세요"/>

 

 

      <Button

           android:id="@+id/khon_test"

           android:layout_width="wrap_content"

           android:layout_height="wrap_content"

           android:text="버튼"/>

 

</LinearLayout>

---------------------------------------

 

MainActivity.java

---------------------------------------

package com.example.edittext;

 

import ...

 

public class MainActivity extends AppCompatActivity {

 

     EditText khon_id;

     Button khon_test;

 

     @Override

     protected void onCreate(Bundle savedInstanceState) {

          super.onCreate(savedInstanceState);

          setContenView(R.layout.activity_main);

 

 

          khon_id = findViewByid(R.id.khon_id);

          khon_test = findViewByid(R.id.khon_test);

 

          khon_test.setOnClickListener(new View.OnClickListener( ) {

                @Override

                public void onClick(View view) {

                     khon_id.setText("khon");

                }

          }};

 

      }

}

---------------------------------------

'안드로이드 앱 만들기' 카테고리의 다른 글

패키지구조 & 역할  (0) 2020.08.01
Image View & Toast  (0) 2020.08.01
intent 화면전환  (0) 2020.08.01
Text View 만들기  (0) 2020.07.25
안드로이드 개발자 모드(USB 디버깅) 설정방법  (0) 2020.07.25
Posted by khon98
,

LinearLayout - 모든 자식 뷰들을 한 방향으로(세로 또는 가로) 지정하는 레이아웃을 의미 orientation을 지정해야 함

 

orientation - 방향을 의미

vertical - 세로를 의미

 

width - 가로를 의미

height - 세로를 의미

 

가로(width)match_parent(부모를 의미) 입력

세로(height)wrap_content(텍스트 크기 만큼 세로 길이를 감싸라 라는 의미) 입력

텍스트 사이즈 단위는 sp

 

activity_main.xml

-----------------------------------------------

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmls:android="http://schemas.android.com/apk/res/android"

      xmls:app="http://schemas.android.com/apk/res-auto"

      xmls:tools="http://schemas.android.com/tools"

      android:layout_width="match_parent"

      android:layout_height="match_parent"

      android:orientation="vertical"

      tools:context=".MainActivity">

 

      <TextView

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:textColor="#03E2FF"

            android:textSize="20sp"

            android:text="khon98"/>

 

      <TextView

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:textColor="#076057"

            android:textSize="40sp"

            android:text="khon01"/>

 

 

 

 

</LinearLayout>

-----------------------------------------------

'안드로이드 앱 만들기' 카테고리의 다른 글

패키지구조 & 역할  (0) 2020.08.01
Image View & Toast  (0) 2020.08.01
intent 화면전환  (0) 2020.08.01
EditText & Button  (0) 2020.07.28
안드로이드 개발자 모드(USB 디버깅) 설정방법  (0) 2020.07.25
Posted by khon98
,

1. 설정

2. 휴대전화 정보

3. 소프트웨어 정보

4. 개발자 옵션

5. USB 디버깅 체크

'안드로이드 앱 만들기' 카테고리의 다른 글

패키지구조 & 역할  (0) 2020.08.01
Image View & Toast  (0) 2020.08.01
intent 화면전환  (0) 2020.08.01
EditText & Button  (0) 2020.07.28
Text View 만들기  (0) 2020.07.25
Posted by khon98
,