Do the game introduction in the text loading has been implemented with TextView, but to see the content of NetEase news, click on the picture can be transferred to a new activity, feel like TextView realized, but do not know how to get, Think of the TextView and imageview layouts that can be dynamically loaded, but when the equivalent is large, it's very complicated. So far no method has been found. Tomorrow, use the method here to see if it can be achieved.
Use TextView to achieve such effects, picture text mixed, text different color font, call and lift browser and so on
The code is as follows:
@Override
public void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.activity_main);
Mytextview = (TextView) This.findviewbyid (R.ID.IMG_IV);
Create a Spannablestring object
Spannablestring sp = new spannablestring ("This sentence has Baidu hyperlinks, there are highlighting, so, or so, there are italic.");
Set up hyperlinks
Sp.setspan (New Urlspan ("http://www.baidu.com"), 5, 7, spanned.span_exclusive_exclusive);
Set highlight Style One
Sp.setspan (New Backgroundcolorspan (color.red), 19,spannable.span_exclusive_exclusive);
Set the highlight style two Sp.setspan (new Foregroundcolorspan (Color.yellow), 20,24,spannable.span_exclusive_inclusive);
Set italic
Sp.setspan (New Stylespan (Android.graphics.Typeface.BOLD_ITALIC), spannable.span_exclusive_inclusive);
Call
Sp.setspan (New Urlspan ("tel:4155551212"), 2, 5,spanned.span_exclusive_exclusive);
The picture shows in TextView.
drawable d = getresources (). getdrawable (R.drawable.ic_launcher);
D.setbounds (0, 0, d.getintrinsicwidth (), D.getintrinsicheight ());
Imagespan span = new Imagespan (d, Imagespan.align_baseline);
Sp.setspan (span, 0, 1, spannable.span_inclusive_exclusive);
Spannablestring Object Set to TextView
Mytextview.settext (SP);
Set TextView to click
Mytextview.setmovementmethod (Linkmovementmethod.getinstance ());
}
Android TextView to achieve text-to-picture mixing effect