如何在showviewview中为listview制作矩形视图

时间:2014-10-04 12:02:21

标签: android listview showcaseview

我正在使用https://github.com/amlcurran/ShowcaseView库进行Showcaseview
如何制作矩形视图而不是圆形?
以及如何将其用于listview项目之一? 感谢

1

2 个答案:

答案 0 :(得分:0)

请参阅示例应用中的CustomShowcaseActivity。它创建了一个矩形展示。它定义了CustomShowcaseView,其中包含一个构造函数,用于设置资源文件dimens.xml中展示矩形的widthheight

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

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

CustomShowcaseView实施ShowcaseDrawer,因此您使用setShowcaseDrawer()。它不是抽屉,而是“抽屉”。

以下内容显示了这一点,并根据需要定位listview

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

sv = new ShowcaseView.Builder(this)
            .setTarget(target)
            .setShowcaseDrawer(new CustomShowcaseActivity.CustomShowcaseView(getResources()))
            .build();

答案 1 :(得分:0)

看看这个: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();

要将其用于某一项,请在if中将onBindViewHolder中的position与特定的task sourceJar(type: Jar) { classifier = 'sources' from sourceSets.main.allSource } 一起使用,并简单地显示它。