FragmentPagerAdapter
1: @Override
2: public CharSequence getPageTitle(int position) {
3: SpannableStringBuilder sb = new SpannableStringBuilder(" Page #"+ position); // space added before text for convenience
4:
5: Drawable main_create = getActivity().getResources().getDrawable(R.drawable.main_create);
6: main_create.setBounds(0, 0, main_create.getIntrinsicWidth(), main_create.getIntrinsicHeight());
7:
8: ImageSpan span = new ImageSpan(main_create, ImageSpan.ALIGN_BASELINE);
9: sb.setSpan(span, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
10: return sb;
11: }