TextViewtv = (TextView)findViewById(R.id.textView); AssetManagermgr=getAssets();//得到AssetManager Typefacetf=Typeface.createFromAsset(mgr, "fonts/mini.TTF");//根据路径得到Typeface tv.setTypeface(tf);//设置字体
StringtextStr1 = "<font color=\"#ffff00\">如果有一天,</font><br>"; StringtextStr2 = "<font color=\"#00ff00\">我厌倦了这里,</font><br>"; StringtextStr3 = "<font color=\"#ff00ff\">我会乘着梦,</font><br>"; StringtextStr4 = "<font color=\"#00ffff\">飞向那个属于自己的<br>世界……</font><br>"; tv.setText(Html.fromHtml(textStr1+textStr2+textStr3+textStr4));
tv.getPaint().setFakeBoldText(true);
android:shadowColor="#ffffff" android:shadowDx="15.0" android:shadowDy="5.0" android:shadowRadius="2.5"
StringimgStr = "<img src=\""+R.drawable.sidai+"\"/>"; Html.ImageGetterimageGetter = new Html.ImageGetter() { public Drawable getDrawable(Stringarg0) { // TODO Auto-generated methodstub int id =Integer.parseInt(arg0); Drawable draw =getResources().getDrawable(id); draw.setBounds(10, 10, 228,300); return draw; } }; tv.append(Html.fromHtml(imgStr,imageGetter,null));
android:drawableBottom=”@drawable/sidai”