728x90
stackoverflow.com/questions/33380668/how-to-set-android-tablayout-in-the-bottom-of-the-screen
How to set android TabLayout in the bottom of the screen?
My question is how I can set the new android material design TabLayout to be in the bottom of the screen, kind of like Instagram's bottom toolbar. If you have never seen Instagram's UI here is a
stackoverflow.com
여기서 알아낸 방법!
다양한 방법이 있겠지만
그 중에서도 가장 간단해보이는 방법인
RelativeLayout(상대적인 위치로 뷰들을 배치시킬 수 있는 레이아웃)을 이용하는 방법을 사용하였다.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"/>
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/tab_layout"/>
</RelativeLayout>
</LinearLayout>
728x90
'안드로이드' 카테고리의 다른 글
[android][kotlin] 카메라 권한 얻어 사용하기 (2) | 2021.02.24 |
---|---|
[android][kotlin] Json과 RecyclerView (0) | 2021.02.17 |
[android] [xml] 버튼 둥글게 만들기 (corner에 radius 주기) (0) | 2021.01.27 |
[android] [kotlin] Retrofit을 사용한 로그인 서비스 (0) | 2021.01.06 |
[android] [kotlin] TabLayout과 ViewPager사용하기 (0) | 2021.01.06 |
댓글