HTML in string resource?

后端 未结 6 1015
有刺的猬
有刺的猬 2020-11-28 02:32

I know I can put escaped HTML tags in string resources. However, looking at the source code for the Contacts application I can see that they have a way of not having to enco

6条回答
  •  忘掉有多难
    2020-11-28 03:08

    The best solution is to use resources in a way:

    Adults are spotted gold and black on the crown, back and wings. Their face and neck are black with a white border; they have a black breast and a dark rump. The legs are black.

    It is similar to two other golden plovers, Eurasian and Pacific.

    The American Golden Plover

    is smaller, slimmer and relatively longer-legged than Eurasian Golden Plover (Pluvialis apricaria) which also has white axillary (armpit) feathers. It is more similar to Pacific Golden Plover (Pluvialis fulva) with which it was once considered conspecific under the name \"Lesser Golden Plover\". The Pacific Golden Plover is slimmer than the American species, has a shorter primary projection, and longer legs, and is usually yellower on the back.

    These birds forage for food on tundra, fields, beaches and tidal flats, usually by sight. They eat insects and crustaceans, also berries.

    ]]>

    and than display it with:

    Spanned sp = Html.fromHtml( getString(R.string.htmlsource));
    tv.setText(sp);
    

    Try to use that resource without and with tv.setText(getText(R.string.htmlsource)); and you will see the difference.

提交回复
热议问题