如何向android添加一步一步的引导机制

时间:2015-11-12 05:43:07

标签: android android-layout

当app首次启动时,我需要为我的Android应用程序添加用户指南

enter image description here

我如何进行这种用户指南导航,还有其他方法吗?

1 个答案:

答案 0 :(得分:2)

我在项目中成功实现了这个Showcase Library。

https://github.com/amlcurran/ShowcaseView

首次使用SharedPreferences在Main Activity的Oncreate中加载此库。

public class classname extends AppCompatActivity 
{
 public SharedPreferences settings;
 public SharedPreferences.Editor editor;
 public boolean firstRun;

 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  settings = getSharedPreferences("PREFS_NAME", 0);
  editor = settings.edit();

  firstRun= settings.getBoolean("FIRST_RUN", false);
   //FIRST_RUN as false by default. 
  if (!firstRun) {

   // Load your showcase at first time

         editor.putBoolean("FIRST_RUN", true);
         editor.commit();
  //saves FIRST_RUN as true, so it will run only at first time

   }

 }
}