Java Android Showcase View 怎么用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22141856/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android Showcase View how to use?
提问by mehmet
Well For Showcase View
很好的展示视图
I using this:
我用这个:
https://github.com/amlcurran/ShowcaseView
https://github.com/amlcurran/ShowcaseView
After importing files it gives error. this is my errors and improted .jar files
导入文件后报错。这是我的错误和改进的 .jar 文件
Errors says
错误说
in java
在 Java 中
R cannot be resolved to a variable
R 无法解析为变量
in style
很有型
error: Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock.Light'.
错误:检索项目的父项时出错:未找到与给定名称“Theme.Sherlock.Light”匹配的资源。
again, in style
再次,风格
error: Error: No resource found that matches the given name: attr 'android:fontFamily'.
错误:错误:找不到与给定名称匹配的资源:attr 'android:fontFamily'。
Also Are there any tutorial to use Showcase view in my project. I can not find and I didnt understant from github project. it is not clear.
是否有任何教程可以在我的项目中使用 Showcase 视图。我找不到并且我没有从 github 项目中了解。不清楚。
采纳答案by Sanjay Hadiya
This library works Awesome for all. How it works?? i want to highlight a toolbar option. Now just add the library and write code like this.
这个库对所有人来说都很棒。这个怎么运作??我想突出显示一个工具栏选项。现在只需添加库并编写这样的代码。
you can use multiple showCaseView using this code
您可以使用此代码使用多个 showCaseView
1add Library in our Gradle.buildimplementation 'com.github.mreram:ShowCaseView:1.0.5'
1在我们的 Gradle.build实现中添加库'com.github.mreram:ShowCaseView:1.0.5'
simple call this method with pass title, Description Text, view or view Id and Type
简单地使用传递标题、描述文本、视图或视图 ID 和类型调用此方法
ShowIntro("SetTheme", "Select Theme and Apply on your video", R.id.button_tool_theme, 1);
method create like this
方法像这样创建
private void ShowIntro(String title, String text, int viewId, final int type) {
new GuideView.Builder(this)
.setTitle(title)
.setContentText(text)
.setTargetView((LinearLayout)findViewById(viewId))
.setContentTextSize(12)//optional
.setTitleTextSize(14)//optional
.setDismissType(GuideView.DismissType.targetView) //optional - default dismissible by TargetView
.setGuideListener(new GuideView.GuideListener() {
@Override
public void onDismiss(View view) {
if (type == 1) {
ShowIntro("Editor", "Edit any photo from selected photos than Apply on your video", R.id.button_tool_editor, 6);
} else if (type == 6) {
ShowIntro("Duration", "Set duration between photos", R.id.button_tool_duration, 2);
} else if (type == 2) {
ShowIntro("Filter", "Add filter to video ", R.id.button_tool_effect, 4);
} else if (type == 4) {
ShowIntro("Add Song", "Add your selected song on your video ", R.id.button_tool_music, 3);
} else if (type == 3) {
ShowIntro("Overlay", "Add your selected overlay effect on your video ", R.id.button_tool_overlay, 5);
} else if (type == 5) {
SharePrefUtils.putBoolean("showcase", false);
}
}
})
.build()
.show();
}
回答by Julia Hexen
The sample you use needs the ActionBarSherlock Library, you can read it in the instructions from the github page: "To use the sample download ActionBarSherlock and add it as a dependency to the library project. Use point 1 on the "Including in your project" instructions at the link."
您使用的示例需要ActionBarSherlock库,您可以在github页面的说明中阅读它:“使用示例下载ActionBarSherlock并将其作为依赖添加到库项目中。使用“包含在您的项目中”上的第1点链接中的说明。”
- download ActionBarSherlock and import it (only the library, you don't need the samples)
- right click to your SampleActivity project and choose Properties
- choose Android, click Add and include the ActionBarSherlock project
- 下载 ActionBarSherlock 并导入(只有库,您不需要示例)
- 右键单击您的 SampleActivity 项目并选择Properties
- 选择Android,单击 Add 并包含 ActionBarSherlock 项目
Then the style errors will go away and R can be built.
然后样式错误将消失并且可以构建 R。
回答by vuhung3990
- import, add actionbarsherlock library
- android:fontFamily minSDK is 16, or delete this
- project -> clean all
- 导入,添加 actionbarsherlock 库
- android:fontFamily minSDK 为16,或者删除这个
- 项目 -> 清理所有
回答by pavel
Here for this I am using this library
为此,我正在使用这个库
https://github.com/amlcurran/ShowcaseView
https://github.com/amlcurran/ShowcaseView
This library works really great. How it works?? Suppose i want to highlight a menu option. Now just add the library and white this code.
这个库真的很棒。这个怎么运作??假设我想突出显示一个菜单选项。现在只需添加库并将此代码设为白色。
Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.inflateMenu(R.menu.menu_main);
setSupportActionBar(toolbar);
ViewTarget target = new ViewTarget(toolbar.findViewById(R.id.menu_id_launcher));
new ShowcaseView.Builder(this)
.setContentTitle("Its My Navigation Drawer")
.setContentText("Click here and you will get options to navigate to other sections.")
.useDecorViewAsParent() //this is the difference
.setTarget(target)
.build();
}
and finally you have to make your menu show always like this
最后你必须让你的菜单总是这样显示
<item
android:id="@+id/menu_id_launcher"
android:orderInCategory="100"
android:icon="@mipmap/ic_launcher"
android:title="@string/action_settings"
app:showAsAction="always" />
Now just run the app i think this will works perfectly.
现在只需运行该应用程序,我认为这将完美运行。
回答by SopCam
I usually use another library for showcase views. It creates bubbles instead of concentric circles but it works really well. Maybe it is also useful for your requirements and with this one you don't have importing problems.
我通常使用另一个库来展示视图。它会产生气泡而不是同心圆,但效果很好。也许它对您的要求也很有用,有了这个,您就不会遇到导入问题。
You just have to add 'implementation 'com.elconfidencial.bubbleshowcase:bubbleshowcase:1.3.0' in your build.gradle file of your app and synchronize your project.
您只需在应用的 build.gradle 文件中添加 'implementation 'com.elconfidencial.bubbleshowcase:bubbleshowcase:1.3.0' 并同步您的项目。
It works similar to ShowCaseView library:
它的工作原理类似于 ShowCaseView 库:
BubbleShowCaseBuilder(this) //Activity instance
.title("foo") //Any title for the bubble view
.targetView(view) //View to point out
.show() //Display the ShowCase
Source https://github.com/ECLaboratorio/BubbleShowCase-Android