android - ShowcaseView 替换或删除 EndButton

标签 android showcaseview

所以,我是这个库 ( https://github.com/amlcurran/ShowcaseView ),它工作得很好,但我需要隐藏它的按钮,因为我真的不需要它。我尝试使用 .replaceEndButton() 方法,将其替换为我添加到 的 XML 文件中的一个不可见按钮,但它崩溃了

最佳答案

我通过以编程方式创建一个按钮并使其具有 GONE 可见性来修复它。

 Button button = new Button(getContext());
    button.setText("");
    button.setEnabled(false);
    button.setVisibility(View.GONE);

然后在 ShowcaseView 构建器方法 replaceEndButton() 上,我像这样发送这个新按钮:

ShowcaseView sv = new ShowcaseView.Builder(getActivity())
            .withMaterialShowcase()
            .setTarget(new ViewTarget(fabIntercom))
            .hideOnTouchOutside()
            .replaceEndButton(button)
            .setStyle(R.style.CustomShowcaseTheme)
            .setContentTitle(R.string.showcase_main_title)
            .setContentText(R.string.showcase_main_message)
            .singleShot(42)
            //.setParent()
            .build();

关于android - ShowcaseView 替换或删除 EndButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39478343/

相关文章:

android - 如何将 ShowcaseView 与 GridView 或 ListView 一起使用

android - 如何获取 ActionBar View ?

java - 当用户离开应用程序时无法通过完成完成执行

android - MainActivity 扩展 ListActivity 崩溃应用程序?

android - 如何更改 react-native 中的默认 fontFamily

java - 检查 Parse.com 类是否为(未定义)

java - Sharedpreferences 在 onCreateOptionsMenu 中不起作用

android - Gradle 错误 : Failed to resolve: com. google.firebase :firebase-core:16. 0.1

android - 如何将 ShowCaseView v5 构建器与 fragment 一起使用?

android - 覆盖图像以在 Android 应用程序中制作教程