android 一行代码实现引导页

最近一直在反思…
会持续更新一些有用的小组件,如果你喜欢的话就请给star,你的star会是我持续更新的动力,与大家共勉!加油!

先上效果图:

使用方式:
gradle用法:

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
     dependencies {
	        implementation 'com.github.Johnjson:GuideActivity:1.0.0'
	}

maven用法:

	
		
		    jitpack.io
		    https://jitpack.io
		
	
	
	    com.github.Johnjson
	    GuideActivity
	    1.0.0
	

项目中使用:

    
public class MainActivity extends AppCompatActivity implements CallBack {

    private GuideCustomViews GuideCustomViews;
    private final int[] mPageImages = {
            R.mipmap.guide_1,
            R.mipmap.guide_2,
            R.mipmap.guide_3,
            R.mipmap.guide_4
    };

    private final int[] mGuidePoint = {
            R.mipmap.icon_guide_point_select,
            R.mipmap.icon_guide_point_unselect
    };



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main);

        initView();
    }

    private void initView() {
        GuideCustomViews = findViewById(R.id.guide_CustomView);
        GuideCustomViews.setData(mPageImages, mGuidePoint, this);
    }

    @Override
    public void callSlidingPosition(int position) {
        Log.e("callSlidingPosition", "滑动位置 callSlidingPosition " + position);
    }

    @Override
    public void callSlidingLast() {
        Log.e("callSlidingLast", "滑动到最后一个callSlidingLast");
    }

@Override
    public void onClickLastListener() {
        Log.e("callSlidingLast", "点击最后一个view");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        GuideCustomViews.clear();
    }
}

欢迎star,项目地址

你可能感兴趣的:(Android基础)