答案 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
}
}
}