本文介绍了添加额外的图像/图标CardFragment(Android Wear)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在看谷歌从该样本图片,并试图找出如何实现这样的事情。

I'm looking at this sample image from Google, and trying to figure out how to implement something like this.

看起来非常相似,需要一个标题,描述和图标的标准 CardFragment 布局。但我看到在左边,这让我觉得他们使用自定义布局一个额外的时钟图像/动画。这是可以做到与标准 CardFragment ?还是有另一种方便类,允许多个图标支持?

It looks very similar to the standard CardFragment layout that takes a title, description and icon. But I see an extra clock image/animation on the left, which makes me think they use a custom layout. Is this possible to do with a standard CardFragment? Or is there another convenience class that allows support for multiple icons?

推荐答案

我通过扩展CardFragment并覆盖完成了这个 onCreateContentView

I accomplished this by extending the CardFragment and overriding onCreateContentView:

@Override
public View onCreateContentView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_my_card, null);
    ...
}

这可以让你控制什么那张白卡上。

This lets you control what goes on the white card.

这篇关于添加额外的图像/图标CardFragment(Android Wear)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 22:18