반응형
강의 반복 학습
변수 선언
startActivity(intent) 주의
랜덤함수사용 이미지 띄우기
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:padding="30dp">
<ImageView
android:id="@+id/imgView_picture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/sparta"
app:layout_constraintBottom_toTopOf="@id/txt_id"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/txt_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="아이디 : qasd"
app:layout_constraintBottom_toTopOf="@id/txt_name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/imgView_picture" />
<TextView
android:id="@+id/txt_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="이름 : 홍길동"
app:layout_constraintBottom_toTopOf="@id/txt_age"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/txt_id" />
<TextView
android:id="@+id/txt_age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="나이 : 00세"
app:layout_constraintBottom_toTopOf="@id/btn_cancel"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/txt_name" />
<Button
android:id="@+id/btn_cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="종료"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/txt_age" />
//소현님 제작
//parent는 view 끝자락
//endend
//startstart
//bottomtop
</androidx.constraintlayout.widget.ConstraintLayout>
fun onButton1Clicked(v: View){
val myIntent = Intent(Intent.ACTION_VIEW, Uri.parse("https://m.naver.com"))
startActivity(myIntent)
}
//버튼 클릭시 네이버페이지
fun onButton2Clicked(v: View){
val myIntent2 = Intent(Intent.ACTION_VIEW, Uri.parse("tel: 010-1234-1234"))
startActivity(myIntent2)
}
//버튼 클릭시 하나는 전화걸기
// 클래스 첫글자 대문자
class MainActivity{
}
}
// 첫 글자인 o는 소문자, 새로운 단어(Create, Activity)의 첫 글자(C, A)는 대문자
fun onCreateActivity() // 함수
// _기준소문자 스네이크 케이스
fun on_create_activity() // 함수
// 상수명은 모두 대문자로 작성합니다.
const val HELLO: String = "안녕" //상수
if (strData.isEmpty()) {
Toast.makeText(applicationContext, "아이디/비밀번호를 확인해주세요", Toast.LENGTH_SHORT).show()
} else {
// 아이디/비밀번호 입력 안할시 문구 뜨면서 입력하라는 if문
반응형
'개발일기' 카테고리의 다른 글
23.08.04 부트캠프 26일차 TIL 레지스터 사용법 (0) | 2023.08.04 |
---|---|
23.08.03 부트캠프 25일차 TIL 이미지 구현 (4) | 2023.08.03 |
23.08.01 부트캠프 23일차 WIL (0) | 2023.08.01 |
23.08.01 부트캠프 23일차 TIL (4) | 2023.08.01 |
23.07.31 부트캠프 22일차 TIL (0) | 2023.07.31 |