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

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

貴陽(yáng)網(wǎng)絡(luò)網(wǎng)站建設(shè)八上數(shù)學(xué)優(yōu)化設(shè)計(jì)答案

貴陽(yáng)網(wǎng)絡(luò)網(wǎng)站建設(shè),八上數(shù)學(xué)優(yōu)化設(shè)計(jì)答案,網(wǎng)站定制的公司,phpmysql網(wǎng)站開發(fā)全程實(shí)例效果 第一步:按如下所示代碼創(chuàng)建一個(gè)用來(lái)高亮顯示文本的工具類: public class KeywordUtil {/*** 單個(gè)關(guān)鍵字高亮變色* param color 變化的色值* param text 文字* param keyword 文字中的關(guān)鍵字* return*/public static SpannableString highLigh…

效果

在這里插入圖片描述

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

public class KeywordUtil {/*** 單個(gè)關(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;}
}

第二步:在主布局文件中添加三個(gè)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)限請(qǐng)求的方法";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/60797.html

相關(guān)文章:

  • html網(wǎng)站開發(fā)實(shí)戰(zhàn)教程seo營(yíng)銷是什么意思
  • 學(xué)術(shù)會(huì)議網(wǎng)站怎么做seo描述快速排名
  • 去除wordpress 廣告湖南正規(guī)關(guān)鍵詞優(yōu)化首選
  • 做淘寶相關(guān)網(wǎng)站seo下載站
  • 做招聘信息的網(wǎng)站有哪些內(nèi)容重慶網(wǎng)站關(guān)鍵詞排名
  • 雄安新區(qū)做網(wǎng)站公司東莞整站優(yōu)化推廣公司找火速
  • 余姚網(wǎng)站推廣優(yōu)化工具箱
  • 怎么建立一個(gè)網(wǎng)站csdn中國(guó)十大電商平臺(tái)有哪些
  • 貴州省交通建設(shè)工程質(zhì)量監(jiān)督局網(wǎng)站大數(shù)據(jù)精準(zhǔn)營(yíng)銷案例
  • 做網(wǎng)站好的網(wǎng)站建設(shè)公司百度世界500強(qiáng)排名
  • 做微信活動(dòng)是做網(wǎng)站還是做小程序好百度地圖導(dǎo)航2022最新版
  • 淘寶做首頁(yè)熱點(diǎn)的什么網(wǎng)站微信營(yíng)銷軟件哪個(gè)好用
  • 網(wǎng)站開發(fā) 網(wǎng)絡(luò)工程 哪個(gè)好設(shè)計(jì)網(wǎng)頁(yè)的軟件
  • 做公眾號(hào)還是網(wǎng)站百度一下你就知道了主頁(yè)
  • 網(wǎng)站建設(shè)維護(hù)php網(wǎng)上互聯(lián)網(wǎng)推廣
  • 貴司不斷優(yōu)化網(wǎng)站建設(shè)軟文世界平臺(tái)
  • 企業(yè)網(wǎng)站免費(fèi)建站程序百度官網(wǎng)app下載安裝
  • 廈門的企業(yè)網(wǎng)站國(guó)際新聞今日頭條
  • 英文商務(wù)網(wǎng)站制作百度互聯(lián)網(wǎng)營(yíng)銷是什么
  • 網(wǎng)站備案信息核驗(yàn)單填寫成都網(wǎng)絡(luò)推廣優(yōu)化
  • 做百度移動(dòng)端網(wǎng)站優(yōu)web成品網(wǎng)站源碼免費(fèi)
  • 如何注冊(cè)公司網(wǎng)站免費(fèi)注冊(cè)百度競(jìng)價(jià)排名服務(wù)
  • wordpress+更新+慢贛州seo
  • 什么軟件可以做app軟件seo是什么職業(yè)做什么的
  • 福田慶三baby案例照批量?jī)?yōu)化網(wǎng)站軟件
  • 網(wǎng)站建設(shè)培訓(xùn)招生長(zhǎng)尾詞挖掘
  • 安平誰(shuí)做網(wǎng)站好百度快速收錄軟件
  • 專業(yè)APP客戶端做網(wǎng)站抖音推廣
  • 設(shè)計(jì)師網(wǎng)站prinestsem推廣競(jìng)價(jià)托管公司
  • 網(wǎng)站建設(shè)與管理初級(jí)教學(xué)搜索引擎優(yōu)化排名品牌