概述
1、textView设置两种不同颜色字体、大小
TextView textView = new TextView(context); SpannableString styleText = new SpannableString("审批编号:" + bean7006.getData().getUserSchoolFlowOrder().getId()); styleText.setSpan(new TextAppearanceSpan(this, R.style.style0), 0, 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); styleText.setSpan(new TextAppearanceSpan(this, R.style.style1), 5, String.valueOf(bean7006.getData().getUserSchoolFlowOrder().getId()).length() + 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(styleText, TextView.BufferType.SPANNABLE); LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); ll.setMargins(0, 10, 0, 0); linearSection.addView(textView, ll);*引用的R.style.style0和R.style.style1为:
<style name="style0"> <item name="android:textSize">14sp</item> <item name="android:textColor">@color/textcolorgary</item> </style> <style name="style1"> <item name="android:textSize">14sp</item> <item name="android:textColor">@color/textcolor</item> </style>
最后
以上就是迷你太阳为你收集整理的TextView的用法的全部内容,希望文章能够帮你解决TextView的用法所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复