新的谷歌现在和Google+卡接口 [英] New Google Now and Google+ card interface

查看:136
本文介绍了新的谷歌现在和Google+卡接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谷歌现在和Google+(安卓)两者使用的卡片式界面的。

Google Now and Google+ (Android) both make use of a card-like interface.

我想知道如果任何人有任何想法如何这个接口可以在Android上被复制。

I was wondering if anyone had any idea how this interface can be replicated on Android.

他们都有很有趣的动画也显示新卡;任何想法将是巨大的。

They both have quite interesting animations for displaying new cards too; any thoughts would be great.

推荐答案

我已经张贴在如何复制教程/创建谷歌卡片式布局的here

I have posted a tutorial on how to replicate / create Google Cards style layout here.

关键步骤

  1. 创建一个自定义布局
  2. 添加观测绘制儿童
  3. 在动画交替卡

下面有一个code段

@Override
public void onGlobalLayout() {
    getViewTreeObserver().removeGlobalOnLayoutListener(this);

    final int heightPx = getContext().getResources().getDisplayMetrics().heightPixels;

    boolean inversed = false;
    final int childCount = getChildCount();

    for (int i = 0; i < childCount; i++) {
        View child = getChildAt(i);

        int[] location = new int[2];

        child.getLocationOnScreen(location);

        if (location[1] > heightPx) {
            break;
        }

        if (!inversed) {
            child.startAnimation(AnimationUtils.loadAnimation(getContext(),
                    R.anim.slide_up_left));
        } else {
            child.startAnimation(AnimationUtils.loadAnimation(getContext(),
                    R.anim.slide_up_right));
        }

        inversed = !inversed;
    }

}

这篇关于新的谷歌现在和Google+卡接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆