-1
我在論壇尋找答案,我試着這樣做,但由於某種原因,顏色沒有改變,有沒有什麼我做錯了?添加一個字符串到textView,但改變它的顏色
SpannableString wordtoSpan = new SpannableString(songSelected);
wordtoSpan.setSpan(
new ForegroundColorSpan(getResources().getColor(R.color.red)),
wordtoSpan.length()-1,
wordtoSpan.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
selected_song.setText("Selected song is: "+ wordtoSpan);