如何实现像Android Lollipop应用程序的第一个启动教程:像Sheets,Slides应用程序?

时间:2014-11-16 05:42:27

标签: android android-5.0-lollipop

我的Nexus 5中安装了Android 5.0最终版本。我注意到它在第一次启动时显示教程非常漂亮,干净和优雅。像#34; Sheets","幻灯片"等应用等。

我们如何在Android L兼容应用中实现这一功能?

该应用程序也会淡出第一个启动屏幕,然后显示教程。

Tutorial screen 1 Initial screen which fades off and shows the tutorial

7 个答案:

答案 0 :(得分:35)

有一个非常好的库可以模拟这些首次运行的教程: https://github.com/PaoloRotolo/AppIntro

AppIntro example screenshot

点击查看大图

答案 1 :(得分:15)

首先,这不是秘密。插图的质量是获得这个漂亮结果的关键。因此,除非您自己是设计师,否则您必须为他们找到一位优秀的设计师。

公寓,我可以看到几种方法来接近这一点。

  1. 首先,对插图有一个非常微妙的视差效果。您可以使用this ParallaxTransformPage gist来实现它。我使用它并且效果很好。

  2. 此外,切换页面时here's a lib that let you smoothly change the screen's background color

  3. 对于splashscreen淡出动画,您可以执行以下操作:

    final ImageView launchScreen = (ImageView) context.findViewById(R.id.launch_screen_view);
    new Handler().postDelayed(new Runnable()
    {
        @Override
        public void run()
        {
            Animation animation = AnimationUtils.loadAnimation(context, android.R.anim.fade_out);
            animation.setAnimationListener(new Animation.AnimationListener()
            {
                // ...
    
                @Override
                public void onAnimationEnd(Animation animation)
                {
                    launchScreen.setVisibility(View.GONE);
                }
            });
            launchScreen.startAnimation(animation);
        }
    }, 2000);
    
  4. 关注linkas's answer使用ViewPagerIndicator以及如何在用户首次启动应用时启动教程。

答案 2 :(得分:8)

这个git应该可以帮助你实现你想要的: https://github.com/spongebobrf/MaterialIntroTutorial

正如您所提到的,这个Android库展示了一个与Google表格相似的材料介绍教程。

此外,这个库为每个页面设置了背景颜色,当在两个页面之间滚动时,这两种颜色会相互淡化

以下是一些可以帮助你的简介:

  1. https://github.com/HeinrichReimer/material-intro
  2. https://github.com/PaoloRotolo/AppIntro

答案 3 :(得分:5)

我在这里找到了这个图书馆:

CircleIndicator Library

它创建了一个类似Lollipop的ViewPager与这些圈子。只需格式化布局,使其适合您的应用程序,然后您就可以了。它不包含动画,但我认为这是一个开始。

答案 4 :(得分:2)

您可以在此处使用ViewPagerIndicator:http://viewpagerindicator.com/#download。然后,您应该定义SharedPreferences,以仅显示ViewPager一次。你可以写:

public class MainActivity extends Activity {
    public static final String MyPrefs = "MyPrefs";
    ...

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

        SharedPreferences sp = getSharedPreferences(MyPrefs, Context.MODE_PRIVATE);
        if (!sp.getBoolean("first", false)) {
            SharedPreferences.Editor editor = sp.edit();
            editor.putBoolean("first", true);
            editor.commit();
            Intent intent = new Intent(this, SampleCirclesDefault.class); //call your ViewPager class
            startActivity(intent);
        }
    }
}

答案 5 :(得分:2)

也许您想使用Roman Nurik解决方案之一:https://github.com/romannurik/Android-WizardPager

答案 6 :(得分:0)

如果您不想使用库,则非常简单。我曾经使用过库,但我开始实现自定义版本。您所要做的就是使用选项卡式视图和查看寻呼机。然后将教程中的所有这些页面设计为片段。这些片段可以包含任何位置的任何按钮,以及您喜欢的不同样式,因为您自己实现每个片段。并不困难。最后,只需使用共享首选项,检查它是否是第一次运行。如果它是如何活动的所有片段。否则不显示该活动。

相关问题