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

设置数据源怎么设置View作为数据源,想实现不同的页面 #119

Open
xiaolunan opened this issue Jun 30, 2020 · 0 comments
Open

Comments

@xiaolunan
Copy link

`private void initView() {
mList = new ArrayList<>();
inflater = LayoutInflater.from(this);
View view1 = inflater.inflate(R.layout.layout_1, null);
View view2 = inflater.inflate(R.layout.layout_1, null);
View view3 = inflater.inflate(R.layout.layout_1, null);
View view4 = inflater.inflate(R.layout.layout_1, null);
mList.add(view1);
mList.add(view2);
mList.add(view3);
mList.add(view4);
mzBannerView = findViewById(R.id.banner);
//设置是否显示Indicator
mzBannerView.setIndicatorVisible(false);
// 设置数据
mzBannerView.setPages(mList, new MZHolderCreator() {
@OverRide
public BannerViewHolder createViewHolder() {
return new BannerViewHolder();
}
});
}

public static class BannerViewHolder implements MZViewHolder<View> {

    @Override
    public View createView(Context context) {
        // 返回页面布局
        View view = LayoutInflater.from(context).inflate(R.layout.banner_item, null);
        return view;
    }

    @Override
    public void onBind(Context context, int position, View data) {

    }
}`
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