Git Product home page Git Product logo

flycotablayout's Issues

引用问题

compile 'com.flyco.roundview:FlycoRoundView_Lib:1.0.4@aar'
compile 'com.flyco.tablayout:FlycoTabLayout_Lib:1.4.0@aar'

项目中想引用您的库,请问是这两个都需要引用嘛?还是注意需要引用第一个就可以了?

Problem with Indicator

hi.
I have a confusing problem when I use block indicator somthing like this:

code:

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"

tl:tl_indicator_style="BLOCK"

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...

underline 和 indicator的区别

对于CommonTabLayout的两个属性不是很清楚它们的区别,能否解释下,谢谢!
tl_indicator_color 和 tl_underline_color
tl_indicator_height 和 tl_underline_height

不支持ButterKnife吗?例子能不能简单点啊

不支持ButterKnife吗?必须用(compile 'com.android.support:support-v4:23.1.1')这个库?例子能不能简单一点啊,插一堆很难理清楚头绪。有点注释就更好了。
还有就是,你这用起来设置属性很复杂,能否拆成几种模式,或者是单独的空间,或自定义布局来使用?

添加3个fragment 时,则无法显是数据

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点击的建议

大神你好,我最近做项目用到了你的Tab,但是有一点瑕疵,当viewpage里有多个页面,tab中点击到某个界面时候,需要滑过中途的界面。
希望大神能够增加viewpager.setCurrentItem(int item, boolean smoothScroll)这个方法。
期待改进

数据有时候不显示

网络请求数据获取title,然后放在tab上,为什么有时候数据请求成功,但是title不显示呢

国际化

将首页替换成getString(R.string.home) 崩溃

v4与nineoldandroids引用冲突

嗨您好,首先非常感谢您的开源库!我现在有个问题,我的项目中使用了您的库(com.flyco.tablayout:FlycoTabLayout_Lib:2.0.0@aar),我看您的项目中也引用了v4及nineoldandroids;我自己的项目中也引用了com.android.support:support-v4:23.2.1;考虑到与其他v4版本的兼容问题,您看您的库中的v4及nineoldandroids能不能只引用不打包!谢谢

java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getLeft()' on a null object reference

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)

MsgView 在Tab 数量为2个时 未读消息偏移变成在文字的左上角问题

在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"/>

tl:tl_indicator_style="BLOCK" not working

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

http://imgur.com/a/opxs2

How can i do to check or fix

BUG android.content.res.Resources$NotFoundException: Resource ID #0x0

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);

属性不起作用

字体颜色和下划线永远都是白色,设置的颜色不起作用

Suggested support: selected Tab bold, not selected not bold

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);
            }
        }
    }
}

有关禁止tablayout停止滑动的问题

大神你好,我现在项目有个需求,根据条件判断viewpager是否可以滑动,当viewpager禁止滑动后,tablayout还是会滑动,我想问下有没有禁止tablayout滑动的方法,如果没有在源码哪里改比较好?

用SlidingTabLayout+ViewPager,报java.lang.NoSuchMethodError: android.support.v4.view.ViewPager.removeOnPageChangeListener

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);

最后~~~~~~~~~~求原因和解决方案~~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.