아래 그림과 같이 sqlite 데이터베이스의 날짜를 가져 와서 tablayout.can에서 보여주는 것과 비슷한 스 와이프 가능한 tablayout을 만들 수 있는지 알고 싶습니다. 예를 들어 내가 tablayouts.Us에있는 날짜를 표시 할 수 있습니다 정적 이름과 tablayout주고 있지만 동적으로 그것을 만들고 싶습니다.spendee 앱처럼 스 와이프 가능한 tablayout을 만드는 법
2
A
답변
1
사용 TabLayout 및 ViewPager 샘플 코드
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.TabLayout
android:id="@+id/mydriverveh_tabLayout"
android:layout_width="match_parent"
android:layout_height="50dp"
app:tabGravity="fill"
/>
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
다음 FragmentPagerAdapter로 확장 Viewpager 어댑터를 만들고 scrollable
탭
라고
0
그게은 어댑터에 조각을 추가 생성 ~와 함께하는 새로운 활동 ViewPager 탭 그리고 TabLayout에서 모드를 스크롤 가능으로 설정합니다.
<android.support.design.widget.TabLayout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tabs"
app:tabMode="scrollable"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
이 페이지에서 viewgager로 탭 활동을 작성하십시오. TabLayout with viewPager
당신이 무엇을 시도 했습니까 ?? 그 코드를 게시하십시오 .. – Ironman
@ 아이언 나는 arraylist에 주어진 정적 데이터가있는 뷰 페이지와 함께 tablayout을 만들었습니다 –
[this] (http://www.android4devs.com/2015/01/how-to-make-material-design)을 확인하십시오. -sliding-tabs.html) 자습서를 참조하십시오. –