Base View Binding Frame Layout
FrameLayout that uses ViewBinding with a provided inflate function.
제공된 inflate 함수로 ViewBinding을 사용하는 FrameLayout입니다.
Why this class exists / 이 클래스가 필요한 이유:
Provides lifecycle-aware ViewBinding for custom FrameLayout components.
Ideal for container views, overlay views, or single-child wrapper layouts.
Automatically initializes binding on attach and cleans up on detach.
커스텀 FrameLayout 컴포넌트에 생명주기 인식 ViewBinding을 제공합니다.
컨테이너 뷰, 오버레이 뷰, 또는 단일 자식 래퍼 레이아웃에 적합합니다.
attach 시 자동으로 바인딩을 초기화하고 detach 시 정리합니다.
Usage / 사용법:
Extend this class and pass the ViewBinding inflate function reference.
Override onInitBind() to perform initial view setup after binding is ready.
Override onEventVmCollect() to collect ViewModel events with repeatOnLifecycle.
Use the custom layout in XML or create programmatically.
이 클래스를 상속받고 ViewBinding inflate 함수 참조를 전달하세요.
바인딩이 준비된 후 초기 뷰 설정을 수행하려면 onInitBind()를 오버라이드하세요.
repeatOnLifecycle로 ViewModel 이벤트를 수집하려면 onEventVmCollect()를 오버라이드하세요.
XML에서 커스텀 레이아웃을 사용하거나 프로그래밍 방식으로 생성하세요.
Usage example:
// 1. Define custom layout class
class LoadingOverlayView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
) : BaseViewBindingFrameLayout<LayoutLoadingOverlayBinding>(
context, attrs,
inflate = LayoutLoadingOverlayBinding::inflate,
) {
override fun onInitBind(binding: LayoutLoadingOverlayBinding) {
binding.progressBar.isIndeterminate = true
binding.tvMessage.text = "Loading..."
}
fun setMessage(message: String) {
getBinding().tvMessage.text = message
}
fun show() { visibility = VISIBLE }
fun hide() { visibility = GONE }
}
// 2. Use in XML
// <com.example.LoadingOverlayView
// android:id="@+id/loadingOverlay"
// android:layout_width="match_parent"
// android:layout_height="match_parent"
// android:visibility="gone" />Parameters
The type of ViewBinding to be used.
사용할 ViewBinding 타입.
See also
For the parent class with binding lifecycle management.
바인딩 생명주기 관리가 있는 부모 클래스는 ParentsBindingFrameLayout을 참조하세요.
For DataBinding variant with LiveData support.
LiveData 지원이 있는 DataBinding 버전은 BaseDataBindingFrameLayout을 참조하세요.
Constructors
Creates the layout with ViewBinding inflation.
ViewBinding inflate를 사용하는 레이아웃을 생성합니다.
Creates the layout with ViewBinding inflation and attributes.
속성을 포함하여 ViewBinding inflate를 사용하는 레이아웃을 생성합니다.
Creates the layout with ViewBinding inflation and style attribute.
스타일 속성을 포함하여 ViewBinding inflate를 사용하는 레이아웃을 생성합니다.
Creates the layout with ViewBinding inflation and style attributes.
스타일 속성을 포함하여 ViewBinding inflate를 사용하는 레이아웃을 생성합니다.
Properties
Functions
Binds a lifecycle observer to the current LifecycleOwner.
Replaces the observer if the owner changes, prevents duplicate registration.
현재 LifecycleOwner에 라이프사이클 옵저버를 바인딩합니다.
Owner가 변경되면 옵저버를 교체하고, 중복 등록을 방지합니다.
Executes a block when the view has been laid out and measured.
Useful for getting actual view dimensions.
View가 레이아웃되고 측정된 후 블록을 실행합니다.
실제 View 크기를 얻는 데 유용합니다.
Toggles visibility with fade animation.
페이드 애니메이션과 함께 가시성을 토글합니다.
Finds the host LifecycleOwner for this View.
Prioritizes Fragment's viewLifecycleOwner, falls back to Activity.
이 View의 호스트 LifecycleOwner를 찾습니다.
Fragment의 viewLifecycleOwner를 우선시하고, 없으면 Activity를 사용합니다.
Iterates over all child views of this ViewGroup.
이 ViewGroup의 모든 자식 View를 반복합니다.
Gets the view's location on screen as a Pair.
View의 화면상 위치를 Pair로 가져옵니다.
Lifecycle callback placeholder for subclasses.
하위 클래스에서 필요한 경우 오버라이드하는 생명주기 콜백입니다.
Lifecycle callback placeholder for subclasses.
하위 클래스에서 필요한 경우 오버라이드하는 생명주기 콜백입니다.
Called to start collecting ViewModel events.
Typically invoked once per lifecycle (e.g., onCreate or onViewCreated).
ViewModel 이벤트 수집을 시작할 때 호출됩니다.
보통 생명주기 당 1회(onCreate 또는 onViewCreated) 호출됩니다.
Called when the binding is initialized in onCreate().
Implement setup logic that requires binding here.
onCreate에서 바인딩이 초기화된 후 호출됩니다.
바인딩이 필요한 초기화 로직을 여기서 수행하세요.
Lifecycle callback placeholder for subclasses.
하위 클래스에서 필요한 경우 오버라이드하는 생명주기 콜백입니다.
Lifecycle callback placeholder for subclasses.
하위 클래스에서 필요한 경우 오버라이드하는 생명주기 콜백입니다.
Lifecycle callback placeholder for subclasses.
하위 클래스에서 필요한 경우 오버라이드하는 생명주기 콜백입니다.
Lifecycle callback placeholder for subclasses.
하위 클래스에서 필요한 경우 오버라이드하는 생명주기 콜백입니다.
Sets the view's visibility to GONE.
View의 가시성을 GONE으로 설정합니다.
Sets the height of the view.
View의 높이를 설정합니다.
Sets the view height to match parent.
View의 높이를 부모에 맞춥니다.
Sets the view height to wrap content.
View의 높이를 내용에 맞춥니다.
Sets the view's visibility to INVISIBLE.
View의 가시성을 INVISIBLE로 설정합니다.
Sets uniform margin for all sides.
모든 면에 대해 동일한 여백을 설정합니다.
Sets all margin values at once.
모든 여백 값을 한 번에 설정합니다.
Sets a debounced click listener on this view to prevent rapid consecutive clicks.
Uses View's tag system to store timing information, preventing memory leaks.
연속적인 빠른 클릭을 방지하기 위해 디바운스된 클릭 리스너를 설정합니다.
View의 tag 시스템을 사용하여 타이밍 정보를 저장하여 메모리 누수를 방지합니다.
Sets uniform padding for all sides.
모든 면에 대해 동일한 패딩을 설정합니다.
Sets the view's visibility to VISIBLE.
View의 가시성을 VISIBLE로 설정합니다.
Sets the width of the view.
View의 너비를 설정합니다.
Sets the view width to match parent.
View의 너비를 부모에 맞춥니다.
Sets the view width to wrap content.
View의 너비를 내용에 맞춥니다.
Creates an indefinite duration Snackbar without showing it.
The Snackbar will remain visible until dismissed.
표시하지 않고 무제한 시간 Snackbar를 생성합니다.
Snackbar는 닫힐 때까지 계속 표시됩니다.
Creates a long duration Snackbar without showing it.
Allows further customization before displaying.
표시하지 않고 긴 시간 Snackbar를 생성합니다.
표시하기 전에 추가 커스터마이징이 가능합니다.
Creates a short duration Snackbar without showing it.
Allows further customization before displaying.
표시하지 않고 짧은 시간 Snackbar를 생성합니다.
표시하기 전에 추가 커스터마이징이 가능합니다.
Creates and shows an indefinite duration Snackbar from a View.
View에서 무제한 시간 Snackbar를 생성하고 표시합니다.
Creates and shows an indefinite duration Snackbar with a custom view.
커스텀 뷰로 무제한 시간 Snackbar를 생성하고 표시합니다.
Creates and shows a long duration Snackbar from a View.
View에서 긴 시간 Snackbar를 생성하고 표시합니다.
Creates and shows a long duration Snackbar with a custom view.
커스텀 뷰로 긴 시간 Snackbar를 생성하고 표시합니다.
Creates and shows a short duration Snackbar from a View.
View에서 짧은 시간 Snackbar를 생성하고 표시합니다.
Creates and shows a short duration Snackbar with a custom view.
커스텀 뷰로 짧은 시간 Snackbar를 생성하고 표시합니다.
Unbinds the lifecycle observer from this View.
Should be called when detaching the view or changing parent.
이 View에서 라이프사이클 옵저버를 언바인딩합니다.
View를 분리하거나 부모를 변경할 때 호출해야 합니다.