11

我正在为 Showcaseview 使用 https://github.com/amlcurran/ShowcaseView
如何制作矩形视图而不是圆形?
以及如何将它用于列表视图项目之一?谢谢

1
4

2 回答 2

3

请参阅CustomShowcaseActivity示例应用程序中的。它创建了一个矩形展示柜。它定义了CustomShowcaseView一个构造函数,该构造函数从资源文件dimens.xml设置展示矩形的width和:height

width = resources.getDimension(R.dimen.custom_showcase_width);
height = resources.getDimension(R.dimen.custom_showcase_height);

CustomShowcaseActivity中的 ShowcaseView 相关联Builder。这也是设置展示目标的地方。

您使用的CustomShowcaseView工具。它不是抽屉,而是“抽屉”。ShowcaseDrawersetShowcaseDrawer()

下面显示了这一点,并listview根据您的需要定位 a:

ViewTarget target = new ViewTarget(R.id.listView, this);

sv = new ShowcaseView.Builder(this)
            .setTarget(target)
            .setShowcaseDrawer(new CustomShowcaseActivity.CustomShowcaseView(getResources()))
            .build();
于 2017-02-24T18:13:52.717 回答
2

看看这个:MaterialShowCaseView,它是原始 ShowCaseView 库的改进版本。它有更多的功能,比如sequence.withRectangleShape()。矩形展示的一个例子是:

    // single example
new MaterialShowcaseView.Builder(this)
    .setTarget(mButtonShow)
    .setDismissText("GOT IT")
    .withRectangleShape() // this makes it rectangle
    .setContentText("This is some amazing feature you should know about")
    .setDelay(withDelay) // optional but starting animations immediately in onCreate can make them choppy
    .singleUse(SHOWCASE_ID) // provide a unique ID used to ensure it is only shown once
    .show();

要将其用于其中一项,请使用 a ifin onBindViewHolderwith specificposition并简单地显示它。

于 2019-02-02T09:04:04.293 回答