-
引用CategoryPager
在build.gradle中添加依赖
compile 'cn.kanejin.view:category-pager:1.0.2@aar'
-
在layout里定义CategoryPager
<cn.kanejin.view.CategoryPager android:id="@+id/category_pager" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <RelativeLayout android:layout_width="match_parent" android:layout_height="48dp" android:background="@color/colorPrimary"> <cn.kanejin.view.CategoryPagerNav android:id="@+id/category_pager_nav" android:layout_width="match_parent" android:layout_height="match_parent" android:overScrollMode="never" android:layout_marginLeft="8dp" android:layout_marginRight="8dp" android:fadingEdge="none" android:scrollbars="none" > </cn.kanejin.view.CategoryPagerNav> </RelativeLayout> <cn.kanejin.view.CategoryPagerContent android:id="@+id/category_pager_content" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentBottom="true" android:layout_gravity="center" android:flipInterval="30" android:persistentDrawingCache="animation" /> </LinearLayout> </cn.kanejin.view.CategoryPager>
-
在Activity里设置Adapter和Listener
mCategoryPager = (CategoryPager) findViewById(R.id.category_pager); mCategoryPagerAdapter = new DemoCategoryPagerAdapter(this, this.getSupportFragmentManager()); mCategoryPager.setAdapter(mCategoryPagerAdapter);
KaneJinCN/android-CategoryPager
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|