AppIntro快速启动页面

1、在项目的buld文件中添加

allprojects {

repositories {

maven { url 'https://jitpack.io' }

}

}

2添加依懒

//快速引导页面com.android.support:support-v4:23.1.1
implementation('com.github.paolorotolo:appintro:3.4.0') {
    exclude module: 'support-v4'
    exclude group: 'com.android.support'//解决v4冲突
}
3自定义类继承

 

public class MyIntroActivity extends AppIntro {
    private SecondFragment secondFragment;
    private FourthFragment fourthFragment;
    private SystemBarTintManager tintManager;

    @Override
    public void init(@Nullable Bundle savedInstanceState) {

        if (!isTaskRoot()) { //解决在线更新产生多实例的问题
            Intent intent = getIntent();
            String action = intent.getAction();
            if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && action != null && action.equals(Intent.ACTION_MAIN)) {
                finish();
                return;
            }
        }

//        if( Tools.getbool(this,"one")){
//            Intent intent = new Intent(MyIntroActivity.this, WelcomeActivity.class);
//            startActivity(intent);
//            finish();
//        }



      
        secondFragment = new SecondFragment();
        fourthFragment = new FourthFragment();
        addSlide(secondFragment);
        addSlide(fourthFragment);



        setBarColor(Color.parseColor("#00000000"));
        setSeparatorColor(Color.parseColor("#00000000"));

        showSkipButton(false);
        setProgressButtonEnabled(false);

        setVibrate(false);
        setVibrateIntensity(30);




    }



    @Override
    public void onSkipPressed() {

        Toast.makeText(this, "--", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onNextPressed() {

    }

    @Override
    public void onDonePressed() {

    }

    @Override
    public void onSlideChanged() {

    }

//    @Override
//    protected void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_my_intro);
//    }
}

4SecondFragmen

package com.example.shop_demo.Acivity;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.shop_demo.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class SecondFragment extends Fragment {


    @BindView(R.id.welcome_final_iv)
    ImageView welcomeFinalIv;


    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.welcom_final_layout_2, null);
        ButterKnife.bind(view);

        return view;
    }

    @Override
    public void onResume() {
        super.onResume();


    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();

    }
}
package com.example.shop_demo.Acivity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.shop_demo.R;
import com.example.shop_demo.utils.LogUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class FourthFragment extends Fragment {


    @BindView(R.id.welcome_final_iv)
    ImageView welcomeFinalIv;
    @BindView(R.id.welcome_final_tv)
    TextView welcomeFinalTv;

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.welcom_final_layout_4, null);
        ButterKnife.bind(this,view);
        return view;
    }



    @OnClick({R.id.welcome_final_tv,R.id.welcome_final_iv})
    public void onclick() {
        //Toast.makeText(getActivity(), "--", Toast.LENGTH_SHORT).show();
        //LogUtil.d("-----------------");
        Intent intent = new Intent(getActivity(), WelcomeActivity.class);
        startActivity(intent);
        getActivity().finish();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();

    }
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/welcome_final_iv"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/loading_3" />

    <TextView
        android:id="@+id/welcome_final_tv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="50dp"
        android:paddingBottom="10dp"
        android:paddingLeft="30dp"
        android:paddingRight="30dp"
        android:paddingTop="10dp"
        android:text="立即体验"
        android:textSize="16sp" />

</RelativeLayout>

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值