Like putting icon and text in tabs (Sliding Tabs) android?

后端 未结 3 1249
情深已故
情深已故 2021-01-29 01:10

I need to make my application with this appearance (icon and text): https://material-design.storage.googleapis.com/publish/material_v_4/material_ext_publish/0B6Okdz75tqQsbHJuWi0

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-29 01:44

    See my answer Here and follow it properly.

    A little change here will do the trick:

     Drawable image = getActivity().getResources().getDrawable(R.drawable.ic_launcher);
     image.setBounds(0, 0, image.getIntrinsicWidth(), image.getIntrinsicHeight());
     SpannableString sb = new SpannableString(" \n"+"hello");
     ImageSpan imageSpan = new ImageSpan(image, ImageSpan.ALIGN_BOTTOM);
     sb.setSpan(imageSpan, 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
     return sb;
    

    in place of the "hello" use your title.

    Hope it will help.

提交回复
热议问题