0

我知道ShowcaseView可以针对一个确切的视图,但我只想要一个不针对任何对象的半透明演示屏幕,并且我想自定义展示的背景。所以我这样做了:

showcaseView=new ShowcaseView.Builder(this)
               // .setTarget(new ActionViewTarget(this, ActionViewTarget.Type.HOME))
                .setTarget(Target.NONE)
                .setStyle(R.style.Transparent)
                .setContentTitle("Check it out")
                .setContentText("You don't always need a target to showcase")
                .hideOnTouchOutside()
                .singleShot(42)
                .build();

R.style.Transparent喜欢这样:

<style name="Transparent" parent="android:Theme">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:background">@drawable/guide</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:backgroundDimEnabled">false</item>
</style>

但最后,只显示了 contentTitle 和 contentText,@drawable/guide没有显示我的!

如何显示我自己的背景图片,谢谢。

4

1 回答 1

0

您将希望使用该属性sv_backgroundColor,而不是android:background. 不幸的是,这确实意味着您只能使用颜色,而不是可绘制对象。

您可以在此处查看如何声明自定义主题: https ://github.com/amlcurran/ShowcaseView/blob/master/sample/src/main/res/values/styles.xml

于 2014-10-10T15:14:36.770 回答