我正在使用showcaseview的https://github.com/amlcurran/ShowcaseView库
如何使矩形视图而不是圆?
以及如何将其用于ListView项之一?
谢谢
1
最佳答案
请参阅示例应用程序中的CustomShowcaseActivity
。它创建了一个矩形的展示。它使用一个构造函数定义一个CustomShowcaseView
,该构造函数设置资源文件dimens.xml中Showcase矩形的width
和height
:
width = resources.getDimension(R.dimen.custom_showcase_width);
height = resources.getDimension(R.dimen.custom_showcase_height);
CustomShowcaseActivity
与Builder
中的showcase视图关联。这也是设置Showcase目标的位置。CustomShowcaseView
实现了ShowcaseDrawer
,因此您可以使用setShowcaseDrawer()
。它不是一个抽屉,而是一个“绘图员”。如下所示,目标a
listview
如您所愿:ViewTarget target = new ViewTarget(R.id.listView, this);
sv = new ShowcaseView.Builder(this)
.setTarget(target)
.setShowcaseDrawer(new CustomShowcaseActivity.CustomShowcaseView(getResources()))
.build();