Skip to content

공통 Header 사용법 #8

@arieum

Description

@arieum

1. 본인모듈의 build.gradle.ktsimplementation(project(":ui")) 추가

2. 추가하려는 xml에 아래코드입력

<com.capstone.ui.CustomHeaderView
       android:id="@+id/headerView"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       <!--ConstraintLayout일 경우에만-->
       app:layout_constraintTop_toTopOf="parent"
       app:layout_constraintStart_toStartOf="parent"
       app:layout_constraintEnd_toEndOf="parent"/>

3. Fragment/Activity 파일에서 타이틀 & 탭 메뉴 설정하기

  • 타이틀 설정 메서드: setScreenTitle("예시타이틀")
  • 탭 메뉴 설정 메서드: setBeachTabItem(ListOfString)
Image

예시코드

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        setHeaderView()
    }

    private fun setHeaderView() {
        val beachMenu = listOf("강릉", "양양", "고성", "속초")

        binding.headerView.setScreenTitle("파도정보")
        binding.headerView.setBeachTabItem(beachMenu)
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions