検索文字列の両方のxml
文字列を大文字と小文字を切り替えて太字にする方法と、各 xml 文字列を変更したいtextview
場合、この変更はボタンのクリック時に行われます
String strfistsearch= mylist.get(7).get("data4");
if(strfistsearch.equals(strfistsearch))
{
mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View convertView1 = mInflater.inflate(R.layout.first_screen,viewFlow);
TextView txtf = (TextView)convertView1.findViewById(R.id.textView11);
String strfistsearch= mylist.get(7).get("data4");
Log.v("strfistsearch", strfistsearch);
SpannableStringBuilder sb = new SpannableStringBuilder(strfistsearch);
final StyleSpan bss = new StyleSpan(android.graphics.Typeface.BOLD); // Span to make text sb.setSpan(bss, 0, 1, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make first 4 characters Bold sb.setSpan(new ForegroundColorSpan(Color.RED), 0, 1, 0);
txtf.setText(sb);
}
else if(strfistsearch.equals(strfistsearch))
{
mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View convertView1 = mInflater.inflate(R.layout.second_screen,viewFlow);
TextView txtf = (TextView)convertView1.findViewById(R.id.textView11);
String strfistsearch= mylist.get(7).get("data4");
Log.v("strfistsearch", strfistsearch);
SpannableStringBuilder sb = new SpannableStringBuilder(strfistsearch); final StyleSpan bss = new StyleSpan(android.graphics.Typeface.BOLD); // Span to make text sb.setSpan(bss, 0, 1, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make first 4 characters Bold sb.setSpan(new ForegroundColorSpan(Color.RED), 0, 1, 0); txtf.setText(sb);
}
前もって感謝します...