h07000223 / flycotablayout Goto Github PK
View Code? Open in Web Editor NEWAn Android TabLayout Lib
License: MIT License
An Android TabLayout Lib
License: MIT License
compile 'com.flyco.roundview:FlycoRoundView_Lib:1.0.4@aar'
compile 'com.flyco.tablayout:FlycoTabLayout_Lib:1.4.0@aar'
项目中想引用您的库,请问是这两个都需要引用嘛?还是注意需要引用第一个就可以了?
作者,请教个问题,现在是点击tab时默认滑动了viewpager,我想实现一个功能是 点击tab和滑动viewpager时得到的数据不同,请问应该怎么实现?
This is a feature request for icons instead of text in sliding tab, as seen in tab of Flipboard app.
hi.
I have a confusing problem when I use block indicator somthing like this:
tl:tl_indicator_corner_radius="0dp"
tl:tl_indicator_margin_bottom="0dp"
tl:tl_indicator_margin_left="0dp"
tl:tl_indicator_margin_right="0dp"
tl:tl_indicator_margin_top="0dp"
when I use this code in most android devices the indicator do not show.
(in emulator works perfectly)
plz help me!
thank you so much...
不大合适,应该用shade自己定义,例如想要可以描边
indicator无法跟着动态变, 必须要手动切换下才行;
对于CommonTabLayout的两个属性不是很清楚它们的区别,能否解释下,谢谢!
tl_indicator_color 和 tl_underline_color
tl_indicator_height 和 tl_underline_height
不支持ButterKnife吗?必须用(compile 'com.android.support:support-v4:23.1.1')这个库?例子能不能简单一点啊,插一堆很难理清楚头绪。有点注释就更好了。
还有就是,你这用起来设置属性很复杂,能否拆成几种模式,或者是单独的空间,或自定义布局来使用?
如题,当调用setCurrentTab(index)时,OnTabSelectListener() 不会执行。只有手动点击才会执行OnTabSelectListener()的监听。
fragment 添加到3个以上是,无法显示里面的数据,调试发现第三个fragment 的oncreate 没有执行,不知为什么?
两个fragment 是可以正常显示数据?
谢谢!
简单贴下使用代码:
activity:
public void initPager() {
mFragments.add(PIMemberFragment.getInstance());
mFragments.add(PIContactUnitFragment.getInstance());
mFragments.add(PIAttachmentsFragment.getInstance());
mSlidingTabLayout.setViewPager(mViewPager, mTitles, this, mFragments);
mViewPager.setCurrentItem(0);
}
fragment:
public static synchronized PIAttachmentsFragment getInstance() {
if (piAttachmentsFragment == null)
piAttachmentsFragment = new PIAttachmentsFragment();
return piAttachmentsFragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
piAttachmentsFragment = this;
}
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_related_attachments, null);
ll_home_attachments = (LinearLayout) v.findViewById(R.id.ll_home_attachments);
return v;
}
大神你好,我最近做项目用到了你的Tab,但是有一点瑕疵,当viewpage里有多个页面,tab中点击到某个界面时候,需要滑过中途的界面。
希望大神能够增加viewpager.setCurrentItem(int item, boolean smoothScroll)这个方法。
期待改进
网络请求数据获取title,然后放在tab上,为什么有时候数据请求成功,但是title不显示呢
我想换行 我改了下存放 Textview的容器 发现内容是换的 但是 背景呀 整体还是没有换 draw 里边的代码有点没读懂 不太好改
将首页替换成getString(R.string.home) 崩溃
打个招呼,做的挺不错的,感谢分享呢
嗨您好,首先非常感谢您的开源库!我现在有个问题,我的项目中使用了您的库(com.flyco.tablayout:FlycoTabLayout_Lib:2.0.0@aar),我看您的项目中也引用了v4及nineoldandroids;我自己的项目中也引用了com.android.support:support-v4:23.2.1;考虑到与其他v4版本的兼容问题,您看您的库中的v4及nineoldandroids能不能只引用不打包!谢谢
Does the project have a specific license? Could't find it anywhere.
我们的Tab数据是动态的,当Tab数据为空时,需要清空页面上的Tab
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getLeft()' on a null object reference
at com.flyco.tablayout.CommonTabLayout.c(CommonTabLayout.java)
at com.flyco.tablayout.CommonTabLayout.setCurrentTab(CommonTabLayout.java)
at com.richinfo.drive.activity.MainActivity.assignViews(MainActivity.java)
at com.richinfo.drive.activity.MainActivity.onCreate(MainActivity.java)
at android.app.Activity.performCreate(Activity.java:6060)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2604)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2715)
at android.app.ActivityThread.access$800(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1579)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:199)
at android.app.ActivityThread.main(ActivityThread.java:5783)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:982)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:777)
用的slidingTab
private CommonTabLayout tl_3;
tl_3 = ViewFindUtils.find(decorView, R.id.tl_3);
tl_3.setTabData(tabs, getSupportFragmentManager(), R.id.fl_change, fragments2);
// ...
tl_3.setCurrentTab(1);
调用 tl_3.setCurrentTab(1)
后 indicator
不显示了 。
fragment 上面的标题 在tabLayout如何动态去刷新?我现在可能整个标题的list顺序会发生改变 想动态刷新顶部的title!
在demo 上修Tab 数量为2 就可以发现问题了
tabLayout.showMsg(1, 5);
tabLayout.setMsgMargin(1, 5, 10);
xml is
<com.flyco.tablayout.SlidingTabLayout
android:id="@+id/tablayout"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@android:color/white"
android:paddingLeft="16dp"
android:paddingRight="16dp"
tl:tl_textsize="@dimen/text_size_14"
tl:tl_indicator_color="#489DF3"
tl:tl_indicator_height="3dp"
tl:tl_indicator_width_equal_title="false"
tl:tl_tab_padding="22dp"
tl:tl_tab_space_equal="true"
tl:tl_textSelectColor="#000000"
tl:tl_textUnselectColor="#66000000"/>
bug,建议快点修改
I have follow the sameple code
<com.flyco.tablayout.SlidingTabLayout
android:id="@+id/tl_9"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#6D8FB0"
android:paddingLeft="5dp"
android:paddingRight="5dp"
tl:tl_indicator_margin_left="2dp"
tl:tl_indicator_margin_right="2dp"
tl:tl_indicator_style="BLOCK"/>
i have import library too
compile 'com.flyco.tablayout:FlycoTabLayout_Lib:2.0.6@aar'
but i no any BLOCK in menu
How can i do to check or fix
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0 at android.content.res.Resources.getValue(Resources.java:1302) at android.content.res.MiuiResources.getValue(MiuiResources.java:124) at android.content.res.Resources.getDrawable(Resources.java:821) at android.content.res.Resources.getDrawable(Resources.java:788) at com.flyco.tablayout.CommonTabLayout.setMsgMargin(CommonTabLayout.java:863) at com.flyco.tablayout.CommonTabLayout.showMsg(CommonTabLayout.java:809) at com.huanmedia.yourchum.mvp.ui.notifcation.notificationreply.NotificationReplyActivity.initView(NotificationReplyActivity.java:130) at com.huanmedia.yourchum.mvp.ui.notifcation.notificationreply.NotificationReplyActivity.onCreate(NotificationReplyActivity.java:81) at android.app.Activity.performCreate(Activity.java:6051) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2283) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392) at android.app.ActivityThread.access$800(ActivityThread.java:154) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5269) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:910) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:705)
固定宽度
notificationReplySt.setTabWidth(DisplayUtil.px2dip(this, DisplayUtil.getDisplayWidth(this) / 2));
CommonTabLayout 在设置消息的时候报错
notificationReplySt.showMsg((selecsion==0?1:0),count);
字体颜色和下划线永远都是白色,设置的颜色不起作用
这个版本在使用SlidingTabLayout.setViewPager 的时候,经过查看源码发现SlidingTabLayout.addTab的时候没有把TextView添加到tabView
setFillViewport(true)设置滚动视图可以伸缩其内容以填充视口不管用,这个怎么解决啊。。
SegmentTabLayout中, 如何设置indicator的边框宽度或者颜色
如题,现在是用的OnTabSelectListener,只能监听tab上的选中事件呢。。
private void updateTabSelection(int position) {
for (int i = 0; i < mTabCount; ++i) {
View tabView = mTabsContainer.getChildAt(i);
final boolean isSelect = i == position;
TextView tab_title = (TextView) tabView.findViewById(R.id.tv_tab_title);
if (tab_title != null) {
tab_title.setTextColor(isSelect ? mTextSelectColor : mTextUnselectColor);
}
tab_title.getPaint().setFakeBoldText(isSelect);
if (mViewPager.getAdapter() instanceof CustomTabProvider) {
if (isSelect) {
((CustomTabProvider) mViewPager.getAdapter()).tabSelect(tabView);
} else {
((CustomTabProvider) mViewPager.getAdapter()).tabUnselect(tabView);
}
}
}
}
当tab选项为5个的时候,如果选项的字体超过三个字的话,设置未读数两位数以上未读消息时,显示不完全
please update a proguard rules file
CommonTabLayout 标题不能滑动?
如何让ICON和文字的右上角的显示的红点提示在ICON右上角,不要离得太远,如果下面的文字多了,就离得远了。
大神你好,我现在项目有个需求,根据条件判断viewpager是否可以滑动,当viewpager禁止滑动后,tablayout还是会滑动,我想问下有没有禁止tablayout滑动的方法,如果没有在源码哪里改比较好?
1.使用场景:用SlidingTabLayout(CommonTabLayout不知道怎么不加载图片)切换ViewPager。
布局如下:
<com.flyco.tablayout.SlidingTabLayout
android:id="@+id/tlChange"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_unit_3"
android:layout_marginRight="@dimen/size_unit_10"
tl:tl_indicator_height="@dimen/line_size_unit"
tl:tl_indicator_width="@dimen/size_unit_3" />
相关的代码:
mPages = new ArrayList();
mInflater = getLayoutInflater();
mProduct = mInflater.inflate(R.layout.view_product_detail_product, vpContent, false);// 商品
mDetails = mInflater.inflate(R.layout.view_product_detail_details, vpContent, false);// 详情
mComments = mInflater.inflate(R.layout.view_product_detail_comments, vpContent, false);// 评价
// 将页面添加进去页面承载容器
mPages.add(mProduct);
mPages.add(mDetails);
mPages.add(mComments);
PagerAdapter adapter = new PagerAdapter() {
@Override
public int getCount() {
return mPages.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView(mPages.get(position));
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
View view = mPages.get(position);
container.addView(view);
return view;
}
};
vpContent.setAdapter(adapter);
**tlChange.setViewPager(vpContent, mTitles);**//~~~~~~ @H07000223 这行直接报错~~~~~~~
tlChange.setCurrentTab(0);// 默认选中项
vpContent.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
tlChange.setCurrentTab(position % (mPages.size()));
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
// 点击按钮切换页面
tlChange.setOnTabSelectListener(new OnTabSelectListener() {
@Override
public void onTabSelect(int position) {
vpContent.setCurrentItem(position);
}
@Override
public void onTabReselect(int position) {
}
});
2.~~~~~~~报错如下:
java.lang.NoSuchMethodError: android.support.v4.view.ViewPager.removeOnPageChangeListener
at com.flyco.tablayout.SlidingTabLayout.setViewPager(SlidingTabLayout.java:202)
at **com.test.ProductDetailActivity.init(ProductDetailActivity.java:228)
at** com.test.ProductDetailActivity.onCreate(ProductDetailActivity.java:114)
at android.app.Activity.performCreate(Activity.java:5255)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2213)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2299)
at android.app.ActivityThread.access$700(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5308)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
3.然后我在setViewPager(ViewPager vp, String[] titles)方法里面找到这两句:
**this.mViewPager.removeOnPageChangeListener(this);// 这里报错??**
this.mViewPager.addOnPageChangeListener(this);
最后~~~~~~~~~~求原因和解决方案~~
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.