安卓5.0材料设计标签 [英] android 5.0 material design tabs

查看:121
本文介绍了安卓5.0材料设计标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是实现材料的设计风格标签就像在谷歌最新的报刊应用最好的,简单的方法?这正是我要找的,但不知道从哪里开始。提供任何帮助/方向是极大的AP preciated。谢谢你。

What is the best and easy way to implement material design style tabs just like in the latest Google NewsStand app? That is exactly what I'm looking for but don't know where to start. Any help/direction provided is greatly appreciated. Thanks.

推荐答案

帖子 @ChrisBanes的(开发商计划工程师为Android)介绍新工具栏的情况。

This post of @ChrisBanes (Developer Programs Engineer for Android) explain the situation with the new Toolbar.

所以样品可以提供帮助。

So this sample can help.

除了 DevBytes视频。

As well as this DevBytes video.

如果你想有一个库,你可以去这一个,但它不更新为材料设计(我分叉了,如果我有时间,我会尽量更新)。

If you want a library, you can go for this one but It is not updated to material design (I forked it, and If I have some time, I will try to update it).

您可以找到有关新的API 21 @ChrisBanes博客的更多信息,以及the官方Android博客

You can find more information about the new API 21 in @ChrisBanes blog as well as the official android blog

编辑::您可以找到材料设计标签在此回购 jpardogo / PagerSlidingTabStrip

You can find material design tabs in this repo jpardogo/PagerSlidingTabStrip :

我主要做4更改原始库,至今(我会补充工具栏,并修正了一些东西明天):

I basically did 4 changes to the original library, so far (I will add Toolbar and fix some stuff tomorrow):

  1. 更改标签布局的默认参数,使它看起来像更多的材料。
  2. 在该指标,而刷卡标签默认中心。
  3. 的标题的Alpha值的变化取决于所选择的位置。
  4. 能够通过customTabs实现接口'CustomTabProvider`在您的适配器。

  1. Change the default parameters of the tabs layout to make it look like more material.
  2. The indicator is center by default while swiping tabs.
  3. The alpha value of the titles change depending the selected position.
  4. Ability to pass customTabs implementing the interface ´CustomTabProvider` in your adapter.

  • 在情况下,customTab有ID的视图 @ + ID / TAB_TITLE ,这将是利用放置标题和Alpha将作为如常。
  • 如果该接口未实现的话,默认的选项卡布局将使用(TextView的)。
  • In case the customTab have a view with id @+id/tab_title, it will be use to place the title and alpha will act as usual.
  • If this interface is not implemented then, the default Tab layout will be use (TextView).

如果你愿意,你可以用与使用任何本库涟漪自定义选项卡:

If you want you can use a custom tab with ripples using any of this libraries:

  • https://github.com/traex/RippleEffect
  • https://github.com/siriscac/RippleView
  • https://github.com/balysv/material-ripple
  • https://github.com/03uk/RippleDrawable

EDIT2:我改变了动作条为新的支持库Tooolbar。我还动态应用的颜色选项卡,工具栏和状态栏。你可以看到的例子在以下GIF在安卓4.4.3的工作。

I changed the ActionBar for the new support library Tooolbar. I have also applied colors dynamically to the tabs,toolbar and statusBar. You can see the example working in android 4.4.3 on the following gif.

我发了公关与我的变化。如果原项目业主不更新的Maven库,并将其推到Maven我会推我的图书馆叉到Maven的中央。

I sent a PR with my changes. If the original project owner doesn't update the maven library, and push it to maven I will push my library fork to maven central.

这篇关于安卓5.0材料设计标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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