textview的一些设置
qmsp = new SpannableString("p1" + " " + "p2" + " " + "p3" + " "
+ "p4" + " ");
int qLength = qmsp.length(); // ...设置字体(default,default-bold,monospace,serif,sans-serif) qmsp.setSpan(new TypefaceSpan("default-bold"), 0, qLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); // ...设置字体大小(相对值,单位:像素) 参数表示为默认字体大小的多少倍 qmsp.setSpan(new RelativeSizeSpan(1.5f), 0, qLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); // 0.5f表示默认字体大小的一半 // ...设置字体前景色 qmsp.setSpan(new ForegroundColorSpan(Color.MAGENTA), 0, qLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); // 设置前 景色为洋红色 // 设置字体样式正常,粗体,斜体,粗斜体 NORMAL BOLD ITALIC BLOD_ITALIC qmsp.setSpan(new StyleSpan(android.graphics.Typeface.NORMAL), 0, qLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); // 正常 // ...设置问题图片 Drawable qDrawable1 = getResources().getDrawable(R.drawable.pic5); qDrawable1.setBounds(0, 0, qDrawable1.getIntrinsicWidth(), qDrawable1.getIntrinsicHeight()); qDrawable1.setBounds(0, 0, 200, 200); qmsp.setSpan(new ImageSpan(qDrawable1), 0, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); Drawable qDrawable2 = getResources().getDrawable(R.drawable.pic6); qDrawable2.setBounds(0, 0, 200, 200); qmsp.setSpan(new ImageSpan(qDrawable2), 3, 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); Drawable qDrawable3 = getResources().getDrawable(R.drawable.pic7); qDrawable3.setBounds(0, 0, 200, 200); qmsp.setSpan(new ImageSpan(qDrawable3), 6, 8, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);