コード例 #1
0
 /**
  * Quickly insert a ShowcaseView into an Activity, highlighting an item.
  *
  * @param type the type of item to showcase (can be ITEM_ACTION_HOME, ITEM_TITLE_OR_SPINNER,
  *     ITEM_ACTION_ITEM or ITEM_ACTION_OVERFLOW)
  * @param itemId the ID of an Action item to showcase (only required for ITEM_ACTION_ITEM
  * @param activity Activity to insert the ShowcaseView into
  * @param title Text to show as a title. Can be null.
  * @param detailText More detailed text. Can be null.
  * @param options A set of options to customise the ShowcaseView
  * @return the created ShowcaseView instance
  */
 public static ShowcaseView insertShowcaseViewWithType(
     int type, int itemId, Activity activity, int title, int detailText, ConfigOptions options) {
   ShowcaseView sv = new ShowcaseView(activity);
   if (options != null) sv.setConfigOptions(options);
   if (sv.getConfigOptions().insert == INSERT_TO_DECOR) {
     ((ViewGroup) activity.getWindow().getDecorView()).addView(sv);
   } else {
     ((ViewGroup) activity.findViewById(android.R.id.content)).addView(sv);
   }
   sv.setShowcaseItem(type, itemId, activity);
   sv.setText(title, detailText);
   return sv;
 }
コード例 #2
0
 public static ShowcaseView insertShowcaseView(
     float x, float y, Activity activity, String title, String detailText, ConfigOptions options) {
   ShowcaseView sv = new ShowcaseView(activity);
   if (options != null) sv.setConfigOptions(options);
   if (sv.getConfigOptions().insert == INSERT_TO_DECOR) {
     ((ViewGroup) activity.getWindow().getDecorView()).addView(sv);
   } else {
     ((ViewGroup) activity.findViewById(android.R.id.content)).addView(sv);
   }
   sv.setShowcasePosition(x, y);
   sv.setText(title, detailText);
   return sv;
 }
コード例 #3
0
 public void setText(int titleTextResId, int subTextResId) {
   String titleText = getContext().getResources().getString(titleTextResId);
   String subText = getContext().getResources().getString(subTextResId);
   setText(titleText, subText);
 }