如何一个接一个地显示Show Case视图

时间:2015-03-11 13:53:25

标签: android

  

我有4个按钮。我需要为每个按钮提供展示视图。但是   问题是在为每个按钮创建展示案例视图时   Oncreate,同时显示所有展示视图。如何显示它   一个接一个??

     

建立代码

 target = new ViewTarget(R.id.shutdown, this);show_showcase(target, "Tutorial", "Click this button...");
   target = new ViewTarget(R.id.track, this);show_showcase(target, "Tutorial", "Click this button to...");
   target = new ViewTarget(R.id.lock, this);show_showcase(target,"Tutorial","Click this button to...");
   target = new ViewTarget(R.id.unlock, this);show_showcase(target,"Tutorial","Click this to ...");
  

function show_showcase

void show_showcase(final ViewTarget target,final String title,final String content) {

   Selection.this.runOnUiThread(new Runnable() {
       public void run() {

                   new ShowcaseView.Builder(Selection.this, true)
                   .setTarget(target)
                   .setContentTitle(title)
                   .setContentText(content)
                   .setStyle(R.style.CustomShowcaseTheme)
                   .build();

       }
   });

}

2 个答案:

答案 0 :(得分:1)

我找到了。我使用的是展示视图版本5,它没有展示视图类。降级并将版本4添加到我的Android Studio项目中并修复了它。

  1. 选择陈旧视图的旧版本
  2. 下载showcaseview库
  3. 将其添加到应用程序
  4. 使用showcaseviews类
  5. 此类的示例在展示视图库

    中的示例应用程序中给出

答案 1 :(得分:0)

使用overrideButtonclick()并在onClickListener()函数中创建一个新的展示组件。