??Android????ViewPager????????????????ViewPager????????????????Tab
??
- ????Tab????????????????????allowWidthFull???????????Item????????????????Tab????????Tab?????????????????????
- ????Tab??????????????????????????
- ???????????????View??????????PagerSlidingTabStrip.addTab()????
- Tab View???????
- ????disableTensileSlidingBlock????????????
??APP
????
??
?JCenter??
dependencies{
compile 'me.xiaopan:pagerslidingtabstrip:lastVersionName'
}
??????
<me.xiaopan.psts.PagerSlidingTabStrip
xmlns:app="http://schemas.android.com/apk/res/????"
android:id="@+id/slidingTabStrip_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/sliding_tab_strip_background"
app:allowWidthFull="true"
app:slidingBlock="@drawable/image_sliding_block">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView style="@style/text_slidingTabTitle" android:text="??"/>
<TextView style="@style/text_slidingTabTitle" android:text="??"/>
<TextView style="@style/text_slidingTabTitle" android:text="??"/>
<TextView style="@style/text_slidingTabTitle" android:text="??"/>
</LinearLayout> </me.xiaopan.psts.PagerSlidingTabStrip>
??????
??????????PagerSlidingTabStrip.setTabViewFactory()????Tab
????????
slidingBlock
??????????????PagerSlidingTabStrip.setSlidingBlockDrawable(Drawable)allowWidthFull
????Tab????PagerSlidingTabStrip?????????Tab??????????????????PagerSlidingTabStrip.setAllowWidthFull(boolean)disableViewPager
???ViewPager???????????????????????????setViewPager()????????disableTensileSlidingBlock
?????????
??ViewPager
ViewPager moreViewPager = (ViewPager) findViewById(R.id.viewPager);
moreViewPager.setAdapter(...);
pagerSlidingTabStrip.setViewPager(moreViewPager);
???
- ???setViewPager(ViewPager)????????ViewPager?Adapter
????????ViewPager.setCurrentItem(int)???????Tab???????setViewPager(ViewPager)????????????
??????????????Android Studio????
##License
/* * Copyright (C) 2013 Peng fei Pan <[email protected]> * * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *
http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */