일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- View
- 알고리즘
- activity
- Algorithm
- CustomView
- 안드로이드
- BOJ
- 백준
- sqlite
- Behavior
- notification
- CollapsingToolbarLayout
- HTTP
- kotlin
- Android
- onLayout
- AppBarLayout
- lifecycle
- onMeasure
- LiveData
- DataBinding
- recyclerview
- 코틀린
- hilt
- ViewModel
- Navigation
- 알림
- Coroutine
- CoordinatorLayout
- room
- Today
- Total
목록View (9)
개발일지
MVVM Model View ViewModel로 이루어진 디자인 패턴이다. MVP 패턴에서 View와 Presenter가 1대1 관계, View가 Presenter에게 의존적인 단점을 보완한 디자인 패턴이다. View에서 사용자의 입력을 받으면 Command Pattern을 통해 ViewModel에 Action을 전달합니다. ViewModel은 해당 Action에 맞게 Model을 업데이트하고 ViewModel은 Model의 업데이트를 수신하여 값을 수정합니다. View도 마찬가지로 ViewModel의 변화를 감지하여 새로운 값을 바인딩합니다. View MVC 패턴에서 View처럼 사용자에게 UI를 제공한다. View는 ViewModel을 알지만 ViewModel은 View를 모릅니다. 또한 DataBi..
MVP Model View Presenter로 이루어진 디자인 패턴입니다. MVC 패턴에서 View와 Controller의 강한 결합도를 해결하기 위해 나온 디자인 패턴이며, Presenter를 통해 View와 Model의 결합을 줄일 수 있습니다. Model MVC 패턴에서 Model과 같이 데이터를 처리에 관한 로직을 담당합니다. 또한 View, Presenter와 독립적입니다. class Model { fun saveData(data: Int) { // Do Something } } View 사용자와 인터렉션을 담당하며 MVC 패턴에서 View와 비슷합니다. 사용자한테 입력을 받고 프레젠터에게 전달한다. 또한 Presenter가 Model에서 데이터를 불러와 가공하여 View에게 전달합니다. Vie..
MVC MVC는 Model View Controller로 어플리케이션 구성을 크게 3가지로 나누어 관리하는 디자인 패턴입니다. Model Model은 데이터베이스에 접근하여 데이터를 변경하거나 추출하여 가공하는 역할을 합니다. class Model { fun findByQuery(query: String): String { return "Hello World : $query" } fun save(data: String) { // Do Something } } 특징 View와 Controller와 독립되어야 하며 데이터에 관련된 로직만 있어야 한다. View View는 UI를 사용자에게 표시하는 역할을 합니다. class View( private val data: String ) { init { print..
Activity와 Fragment가 생명주기를 갖는 것처럼 View도 생명주기를 갖는다. Constructor View(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0, defStyleRes: Int = 0) context : 현재 테마와 리소스를 접근할 수 있도록 도와준다. 도한 동적으로 생성할 때 가장 간단한 방법이다. attrs : XML로 View를 Inflate할 때 XML로 속성을 받아오는 인터페이스다. defStyleAttr : 테마에서 기본 스타일을 지정할 수 있고, 기본 스타일에서 Attr값을 찾아와서 적용한다. defStyleRes : defStyleAttr에서 값을 찾을 수 없는 경우 defStyleRes를 사..
View가 그려지는 순서는 measure -> layout -> draw 과정을 거친다. 또한 전위순회 방식(부모를 그리고 자식을 형제순으로) 으로 그린다. Measure measure(widthMeasureSpec: Int, heightMeasureSpec: Int) View의 크기를 측정하는 과정이다. final 함수이지만 내부적으로 onMeasure를 호출하고 onMeasure를 재정의하여 사용할 수 있다. 아직 ChildView는 measure된 상태가 아니기 때문에 width, measuredWidth 는 0이 반환될 수 있다. setMeasureDimension(measuredWidth: Int, measuredHeight: Int) View의 크기를 측정한다. onMeasure에서 필수적으로..
Context (맥락) Android Developer Interface to global information about an application environment. This is an abstract class whose implementation is provided by the Android system. It allows access to application-specific resources and classes, as well as up-calls for application-level operations such as launching activities, broadcasting and receiving intents, etc. 번역 응용 프로그램 환경에 대한 글로벌 정보에 대한 인터..
View와 ViewGroup을 상속받아서 직접 View를 만들 수 있지만 기존의 정의된 View나 ViewGroup을 상속 받아서 기능을 확장할 수 있다. View 만들기 class LoginButtonView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0, defStyleRes: Int = 0) : MaterialCardView(context, attrs, defStyleAttr), DataBinding { override val binding: ViewLoginButtonBinding by lazy { DataBinding.get(this, R.layout.view_login_b..
CustomeViewGroup Android에서 기본으로 제공하는 ViewGroup(Layout) 대신 ViewGroup을 상속받아 UI를 구축할 수 있다. OverlapLayout 전체코드 class OverlapLayout @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0, defStyleRes: Int = 0) : ViewGroup(context, attrs, defStyleAttr, defStyleRes) { override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { var width = 0 var height..