Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- flutter
- Android
- 안드로이드 튜토리얼
- 개발강의
- android tutorial
- 플러터
- 안드로이드 서비스
- 개발자
- IOS
- 자바
- 디자이너
- 홍드로이드
- 취준생
- 안드로이드
- 코틀린
- hongdroid
- 미라클코딩클럽
- 안드로이드 코딩 기초
- 기획자
- 앱 만들기
- 홍드로이드 강의
- Android Studio
- 코딩
- 안드로이드 예제
- java
- 자바 튜토리얼
- 안드로이드 기초
- 안드로이드 앱 만들기
- 앱 만드는 법
- 안드로이드 스튜디오
Archives
- Today
- Total
홍드로이드의 야매코딩
#2 안드로이드 스튜디오 에딧텍스트 (EditText) 예제 [ 홍드로이드 ] 본문
안녕하세요 안드로이드 앱 강의 유튜버로 활동하는 홍드로이드 입니다.
이번시간은 EditText와 Button 사용법에 대하여 짧고 치열하게 알아볼겁니다!
화면 구성부터 구경해볼까요?
[ 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"
android:orientation="vertical"
tools:context=".MainActivity">
<EditText
android:id="@+id/et_id"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:hint="아이디를 입력하세요..."/>
<Button
android:id="@+id/btn_test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="버튼"/>
</LinearLayout>
|
cs |
[ MainActivity.java ]
package com.hongwan9.edittext;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
EditText et_id;
Button btn_test;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
et_id = findViewById(R.id.et_id);
btn_test = findViewById(R.id.btn_test);
btn_test.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
et_id.setText("홍드로이드");
}
});
}
}
|
cs |
'Android Java' 카테고리의 다른 글
#6 안드로이드 스튜디오 리스트뷰 (ListView) 예제 [ 홍드로이드 ] (0) | 2019.05.21 |
---|---|
#5 안드로이드 스튜디오 폴더 패키지 구조 설명 [ 홍드로이드 ] (0) | 2019.05.21 |
#4 안드로이드 스튜디오 이미지뷰 (ImageView) 예제 [ 홍드로이드 ] (0) | 2019.05.21 |
#3 안드로이드 스튜디오 인텐트 (Intent) 예제 [ 홍드로이드 ] (0) | 2019.05.19 |
#1 안드로이드 스튜디오 텍스트뷰 (TextView) 예제 [ 홍드로이드 ] (0) | 2019.05.18 |