티스토리 뷰
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<Button
android:id="@+id/btnVisible"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_gravity="center"
android:textAllCaps="false"
android:text="Visible"
android:textSize="26dp"
android:textStyle="italic" />
<Button
android:id="@+id/btnGone"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_gravity="center"
android:textAllCaps="false"
android:text="Gone"
android:textSize="26dp"
android:textStyle="italic" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:id="@+id/pbLoading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
MainActivity.kt
package com.jwsoft.kotlinproject
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
btnVisible.setOnClickListener {
pbLoading.visibility = View.VISIBLE
}
btnGone.setOnClickListener {
pbLoading.visibility = View.INVISIBLE
}
}
}
'Android > Kotlin' 카테고리의 다른 글
[Kotlin] Glide (0) | 2020.08.10 |
---|---|
[Kotlin] NestedScrollView (0) | 2020.08.10 |
[Kotlin] viewModelScope + ViewModel (0) | 2020.08.07 |
[Kotlin] by lazy (0) | 2020.08.07 |
[Kotlin] BuildConfig (0) | 2020.08.07 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- James Kim
- activity
- Intent
- ViewPager2
- CoordinatorLayout
- JSONObject
- View
- Livedata
- Kotlin
- 안드로이드
- TabLayout
- 혀가 길지 않은 개발자
- ArrayList
- Android
- recyclerview
- Design Pattern
- 안드로이드 #코틀린 #Android #Kotlin
- coroutine
- Architecture Pattern
- JSONArray
- 자바
- DataBinding
- Vue.js #Vue.js + javascript
- 코틀린
- handler
- MVVM
- XML
- fragment
- java
- ViewModel
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
글 보관함