Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not work with TabLayout #108

Closed
amoikevin opened this issue Mar 7, 2017 · 1 comment
Closed

not work with TabLayout #108

amoikevin opened this issue Mar 7, 2017 · 1 comment

Comments

@amoikevin
Copy link

amoikevin commented Mar 7, 2017

after upgrading to 0.5.0,TabLayout's tabs didn't show up.
demo code:
public class MainActivity extends Activity {

private ViewPager mViewPager;
private PagerAdapter mAdapter = new PagerAdapter() {
    public int getCount() {
        return 3;
    }
    public Object instantiateItem(ViewGroup container, int position) {
        FrameLayout content = new FrameLayout(container.getContext());
        content.setBackgroundColor(0xff000000 | 0xff << (position*8));
        container.addView(content, new LayoutParams(MATCH_PARENT, MATCH_PARENT));
        return content;
    }
};

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(new RenderableView(this) {
        @Override
        public void view() {
            linearLayout(() -> {
                size(MATCH, MATCH);
                orientation(VERTICAL);

                viewPager(() -> {
                    mViewPager = Anvil.currentView();

                    size(MATCH, 0);
                    weight(1);
                    overScrollMode(OVER_SCROLL_NEVER);

                    adapter(mAdapter);
                });
                tabLayout(() -> {
                    size(MATCH, WRAP);
                    tabMode(MODE_FIXED);
                    tabGravity(GRAVITY_FILL);
                    backgroundColor(White);
                    tabTextColors(TabText, SelectedTabText);
                    selectedTabIndicatorColor(Transparent);

                    upWithViewPager(mViewPager);
                });
            });
        }
    });
}

}
result:
ViewPage's content was shown,but the TabLayout was just empty.I was sure I set it up with the viewpager.

@amoikevin
Copy link
Author

after upgrading to "commit 1da406d " ,now it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant