大佬教程收集整理的这篇文章主要介绍了Android一个标签TabLayout,全宽不起作用,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
之后我确实使用了与https://github.com/astuetz/PagerSlidingTabStrip相同的代码
我得到了正确的结果
以前有人遇到过同样的问题吗?以及如何解决这个问题?
我确实使用了简单的代码只是活动保持
<android.support.design.widget.AppBarLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:id="@+id/swipeAppBarLayout" > <android.support.design.widget.TabLayout android:id="@+id/swipeTabLayout" android:layout_width="match_parent" app:tabMaxWidth="0dp" android:layout_height="30dp" app:tabInDicatorHeight="4dp" /> </android.support.design.widget.AppBarLayout> <android.support.v4.view.ViewPager xmlns:android="http://scheR_558_11845@as.android.com/apk/res/android" android:id="@+id/swipePager" android:BACkground="@android:color/transparent" android:layout_width="match_parent" android:layout_height="match_parent" app:layouT_Behavior="@String/appbar_scrolling_view_behavior" />
public class StreamNavigationPagerAdapter extends FragmentStatePagerAdapter { private Context mContext; public StreamNavigationPagerAdapter(FragmentManager fm,Context con) { super(fm); mContext = con; } @Override public Fragment getItem(int position) { return getNewsFragment(); } private Fragment getNewsFragment() { Fragment fragment = new StreamNewsFragment(); return fragment; } @Override public int getCount() { return 1; } @Override public CharSequence getPagetitle(int position) { return "NEWS"; } } the activity contain just @Override protected void onCreate(Bundle savedInstanceStatE) { super.onCreate(savedInstanceStatE); setContentView(R.layout.activity_main); ButterKnife.inject(this); swipePager.setAdapter(new StreamNavigationPagerAdapter(getSupportFragmentManager(),this)); swipeTabLayout.setupWithViewPager(swipePager); // swipeTabLayout.setViewPager(swipePager); }
以上是大佬教程为你收集整理的Android一个标签TabLayout,全宽不起作用全部内容,希望文章能够帮你解决Android一个标签TabLayout,全宽不起作用所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。