0

ボタンのクリック時にfist.xml、second.xml、およびthird.xmlなどのページインジケーターの異なるレイアウトで文字列を一致させる方法。convertviewを使用していますが、各レイアウトxmlの値を太字にしません。

 mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View convertView1 = mInflater.inflate(R.layout.first_screen,null);

// これはコンビューです

String strfistsearch=   mylist.get(9).get("data1");  
      Log.v("strfistsearch", strfistsearch);
    if(strfistsearch.equals(strfistsearch))
      {   
             mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              View   convertView1 = mInflater.inflate(R.layout.first_screen,null);        
               TextView txtf = (TextView)convertView1.findViewById(R.id.textView1);

     SpannableStringBuilder sb = new SpannableStringBuilder(strfistsearch);
    final StyleSpan bss = new StyleSpan(android.graphics.Typeface.BOLD); // Span to make text 
    sb.setSpan(bss, 0, 2, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make first 4 characters Bold 
    sb.setSpan(iss, 4, 6, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make last 2 characters Italic
    sb.setSpan(new ForegroundColorSpan(Color.RED), 0, 2, 0);
    txtf.setText(sb);

       }
    else if(strfistsearch.equals(strfistsearch))
       {
               mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              View   convertView1 = mInflater.inflate(R.layout.first_screen,null);        
               TextView txtf = (TextView)convertView1.findViewById(R.id.textView1);  
     SpannableStringBuilder sb = new SpannableStringBuilder(strfistsearch);
    final StyleSpan bss = new StyleSpan(android.graphics.Typeface.BOLD); // Span to make text 
    sb.setSpan(bss, 0, 2, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make first 4 characters Bold 
    sb.setSpan(iss, 4, 6, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make last 2 characters Italic
    sb.setSpan(new ForegroundColorSpan(Color.RED), 0, 2, 0);
    txtf.setText(sb);

    }

    else if(strfistsearch.equals(strfistsearch))
    {
             mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              View   convertView1 = mInflater.inflate(R.layout.first_screen,null);        
               TextView txtf = (TextView)convertView1.findViewById(R.id.textView1);  
     SpannableStringBuilder sb = new SpannableStringBuilder(strfistsearch);
    final StyleSpan bss = new StyleSpan(android.graphics.Typeface.BOLD); // Span to make text 
    sb.setSpan(bss, 0, 2, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make first 4 characters Bold 
    sb.setSpan(iss, 4, 6, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make last 2 characters Italic
    sb.setSpan(new ForegroundColorSpan(Color.RED), 0, 2, 0);
    txtf.setText(sb);
    }

この問題を修正する方法..事前に感謝..

4

0 に答える 0