Skip to content

一行代码实现ViewPager卡片效果,支持无限循环

License

Notifications You must be signed in to change notification settings

Gaoxichao/CardSlideView

 
 

Repository files navigation

CardSlideView

一行代码实现ViewPager卡片效果,支持无限循环

效果

用法

CardViewPager viewPager = (CardViewPager) findViewById(R.id.viewpager);
viewPager.bind(getSupportFragmentManager(), new MyCardHandler(), Arrays.asList(imageArray));
public class MyCardHandler implements CardHandler<String> {

    @Override
    public View onBind(final Context context, final String data, final int position) {
        View view = View.inflate(context, R.layout.item, null);
        ImageView imageView = (ImageView) view.findViewById(R.id.image);
        Glide.with(context).load(data).into(imageView);
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(context, "data:" + data + "position:" + position, Toast.LENGTH_SHORT).show();
            }
        });
        return view;
    }
}

详细介绍戳这里

gradle依赖

compile 'com.crazysunj:cardslideview:1.1.0'

感谢

android-page-transition

传送门

博客:http://crazysunj.com/

谷歌邮箱:[email protected]

QQ邮箱:[email protected]

License

Copyright 2017 Sun Jian

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

一行代码实现ViewPager卡片效果,支持无限循环

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%