本文整理汇总了Java中com.google.android.glass.widget.CardBuilder.Layout方法的典型用法代码示例。如果您正苦于以下问题:Java CardBuilder.Layout方法的具体用法?Java CardBuilder.Layout怎么用?Java CardBuilder.Layout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.glass.widget.CardBuilder
的用法示例。
在下文中一共展示了CardBuilder.Layout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCardWithImages
import com.google.android.glass.widget.CardBuilder; //导入方法依赖的package包/类
/**
* Returns a new {@link CardBuilder} with the specified layout and adds five images to it for
* the mosaic.
*/
private static CardBuilder createCardWithImages(Context context, CardBuilder.Layout layout) {
CardBuilder card = new CardBuilder(context, layout);
card.addImage(R.drawable.codemonkey1);
card.addImage(R.drawable.codemonkey2);
card.addImage(R.drawable.codemonkey3);
card.addImage(R.drawable.codemonkey4);
card.addImage(R.drawable.codemonkey5);
card.addImage(R.drawable.codemonkey6);
card.addImage(R.drawable.codemonkey7);
card.addImage(R.drawable.codemonkey8);
return card;
}
示例2: setViewCard
import com.google.android.glass.widget.CardBuilder; //导入方法依赖的package包/类
/**
* create and set a card to the given activity
* @param activity an Activity
* @param layout the CardBuilder layout to be used
* @param text optional text
* @param img optional image id
*/
public static void setViewCard(Activity activity, CardBuilder.Layout layout, String text, int img) {
CardBuilder card = new CardBuilder(activity, CardBuilder.Layout.ALERT).setText(text).addImage(img);
activity.setContentView(card.getView());
}