中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

最優(yōu)秀的無錫網(wǎng)站建設(shè)推廣賺錢的app

最優(yōu)秀的無錫網(wǎng)站建設(shè),推廣賺錢的app,免費婚慶網(wǎng)站模板,采購信息網(wǎng)效果 第一步:按如下所示代碼創(chuàng)建一個用來高亮顯示文本的工具類: public class KeywordUtil {/*** 單個關(guān)鍵字高亮變色* param color 變化的色值* param text 文字* param keyword 文字中的關(guān)鍵字* return*/public static SpannableString highLigh…

效果

在這里插入圖片描述

第一步:按如下所示代碼創(chuàng)建一個用來高亮顯示文本的工具類:

public class KeywordUtil {/*** 單個關(guān)鍵字高亮變色* @param color   變化的色值* @param text    文字* @param keyword 文字中的關(guān)鍵字* @return*/public static SpannableString highLight(int color, String text, String keyword) {SpannableString res = new SpannableString("\t\t\t" + text);Pattern pattern = Pattern.compile(keyword);Matcher matcher = pattern.matcher(res);while (matcher.find()) {int start = matcher.start();int end = matcher.end();res.setSpan(new ForegroundColorSpan(color), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);}return res;}public static SpannableString highLight(int color,String text,String... keyword) {SpannableString res = new SpannableString("\t\t\t" + text);for (String key : keyword) {Pattern pattern = Pattern.compile(key);Matcher matcher = pattern.matcher(res);while (matcher.find()) {int start = matcher.start();int end = matcher.end();res.setSpan(new ForegroundColorSpan(color), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);}}return res;}public static SpannableString highLight(int[] cs,String text,String... keyword) {SpannableString res = new SpannableString("\t\t\t" + text);for (int i = 0; i < color.length; i++) {Pattern pattern = Pattern.compile(keyword[i]);Matcher matcher = pattern.matcher(res);while (matcher.find()) {int start = matcher.start();int end = matcher.end();res.setSpan(new ForegroundColorSpan(cs[i]), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);}}return res;}
}

第二步:在主布局文件中添加三個id值分別為textView1、textView3、textView3的TextView控件,然后修改MainActivity類的代碼如下所示:

public class MainActivity extends AppCompatActivity {private android.widget.TextView textView1;private android.widget.TextView textView2;private android.widget.TextView textView3;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);this.textView2 = (TextView) findViewById(R.id.textView2);this.textView1 = (TextView) findViewById(R.id.textView1);this.textView3 = (TextView) findViewById(R.id.textView3);String text = "隨著棉花糖的出現(xiàn),一種新……度,探討處理權(quán)限請求的方法";SpannableString spanStr1 = KeywordUtil.highLight(Color.RED, text, "權(quán)限");textView1.setText(spanStr1);SpannableString spanStr2 = KeywordUtil.highLight(Color.RED, text, "棉花糖","權(quán)限","安卓");textView2.setText(spanStr2);SpannableString spanStr3 = KeywordUtil.highLight(new int[]{Color.RED,Color.GREEN,Color.BLUE}, text, "棉花糖","權(quán)限","安卓");textView3.setText(spanStr3);}
}
http://www.risenshineclean.com/news/27388.html

相關(guān)文章:

  • 網(wǎng)站建設(shè)前臺與后臺最新技術(shù)怎么推廣軟件
  • 做網(wǎng)站排名推廣效果怎么樣新品怎么推廣效果最好
  • net和cn哪個做網(wǎng)站好推廣網(wǎng)站都有哪些
  • 成都網(wǎng)站建設(shè)四川推來客網(wǎng)絡(luò)網(wǎng)絡(luò)營銷試卷
  • 營銷型網(wǎng)站建設(shè)tfx88無錫網(wǎng)站制作推廣
  • h5制作開發(fā)哪找石家莊seo推廣優(yōu)化
  • 深圳商城軟件開發(fā)公司優(yōu)化一個網(wǎng)站需要多少錢
  • 煙臺中企動力提供網(wǎng)站建設(shè)深圳搜索引擎優(yōu)化seo
  • 普洱網(wǎng)站建設(shè)優(yōu)化百度快照排名
  • 網(wǎng)頁制作網(wǎng)站湖南專業(yè)的關(guān)鍵詞優(yōu)化
  • 仿 手機 網(wǎng)站模板html百度seo快速排名優(yōu)化
  • 彩虹云商城游戲行業(yè)seo整站優(yōu)化
  • 百度推廣做網(wǎng)站什么價位網(wǎng)站域名備案查詢
  • 網(wǎng)站建設(shè)建網(wǎng)站互聯(lián)網(wǎng)營銷師培訓(xùn)內(nèi)容
  • 新疆小程序開發(fā)商重慶網(wǎng)站seo搜索引擎優(yōu)化
  • 大畫冊設(shè)計網(wǎng)站b站推廣怎么買
  • wordpress在線報名插件優(yōu)化服務(wù)
  • 響應(yīng)式網(wǎng)站背景晉城網(wǎng)站seo
  • 做網(wǎng)站建設(shè)有前途那合肥seo網(wǎng)絡(luò)營銷推廣
  • 免費建站的網(wǎng)站seo官網(wǎng)優(yōu)化
  • 建設(shè)和住房委員會官方網(wǎng)站谷歌推廣效果怎么樣
  • 完善網(wǎng)站建設(shè)信息流廣告接單平臺
  • 如何使用網(wǎng)站模板國家新聞最新消息今天
  • 蘇州滄浪做網(wǎng)站哪家好網(wǎng)站維護中
  • 連云港網(wǎng)站建設(shè)開發(fā)seo外包一共多少錢
  • 深圳寶安區(qū)什么時候解封網(wǎng)站優(yōu)化外包找誰
  • 南寧做自適應(yīng)網(wǎng)站seo推廣軟件排行榜
  • 成都哪家做網(wǎng)站濰坊新聞頭條最新消息
  • 美容院門戶網(wǎng)站開發(fā)站長之家工具
  • 常用的網(wǎng)絡(luò)營銷的手段有seo優(yōu)化工作