탭 스타일 설정
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayoutRanking"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="20dp"
app:tabIndicatorColor="@color/maincolor"
app:tabSelectedTextColor="@color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView47" >
</com.google.android.material.tabs.TabLayout>
<androidx.viewpager2.widget.ViewPager2
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/viewPager_ranking"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tabLayoutRanking"/>
</androidx.constraintlayout.widget.ConstraintLayout>
https://hanyeop.tistory.com/196?category=942305
[Android] ViewPager2와 TabLayout 사용하여 레이아웃 만들기
탭과 뷰페이저를 사용하면 스와이프해서 다른 프래그먼트를 볼 수 있는 탭을 만들 수 있다. 사용해보기 종속성 추가 android { buildFeatures { viewBinding true } } dependencies { // 뷰페이저 2 implementati..
hanyeop.tistory.com
'아카이빙 > Kotlin' 카테고리의 다른 글
자바이긴 하지만 이거보고 집가서 만들어보기 지금 화면은 너무 쪼꼬매서 하기 힘드렁ㅠ (0) | 2021.08.25 |
---|---|
달력 다이얼로그 (0) | 2021.08.24 |
뒤로가기 2번 누르면 종료 (0) | 2021.08.23 |
커스텀 다이얼로그 & 바텀 시트 다이얼로그 & 리스트 다이얼로그 (0) | 2021.08.20 |
대댓글 만들기 (0) | 2021.08.17 |