반응형
TabLayout
androidx.viewpager.widget.ViewPager
com.google.android.material.tabs.TabLayout
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.emper.hotspotsetting.HotspotSettingActivity">
<com.google.android.material.tabs.TabLayout
android:id="@+id/hotspotsetting_tab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<androidx.viewpager.widget.ViewPager
android:id="@+id/hotspotsetting_viewpager"
android:layout_height="0dp"
android:layout_width="0dp" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintTop_toBottomOf="@+id/hotspotsetting_tab"
app:layout_constraintBottom_toTopOf="@+id/hotspotsetting_dot_tab">
</androidx.viewpager.widget.ViewPager>
<com.google.android.material.tabs.TabLayout
app:tabBackground="@drawable/tab_selector"
app:tabGravity="center"
app:tabIndicatorHeight="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" android:id="@+id/hotspotsetting_dot_tab"/>
</androidx.constraintlayout.widget.ConstraintLayout>
dot로 하는 방법 참고: https://stackoverflow.com/questions/38459309/how-do-you-create-an-android-view-pager-with-a-dots-indicator
반응형
'Android > Android 일반' 카테고리의 다른 글
ViewPager양쪽에 여백 (0) | 2019.05.15 |
---|---|
DisplayMetrics.density (0) | 2019.05.15 |
간단한 Animation Library (0) | 2019.05.08 |
NestedScrollView (0) | 2019.05.07 |
Fragment에서 Intent사용 (0) | 2019.05.07 |