Android 在我的代码文本视图中不显示粗体我将怎么做?

Android 在我的代码文本视图中不显示粗体我将怎么做?,android,Android,在我的第四个屏幕类中,所选文本将不显示粗体,仅早餐将显示粗体,午餐和晚餐不显示粗体,当我按img2或img3时,请告诉我该怎么办??所有值均显示在吐司上,但不显示加粗文字,仅当pres img为“使早餐加粗”时,午餐和晚餐不显示加粗文字 img1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO

在我的第四个屏幕类中,所选文本将不显示粗体,仅早餐将显示粗体,午餐和晚餐不显示粗体,当我按img2或img3时,请告诉我该怎么办??所有值均显示在吐司上,但不显示加粗文字,仅当pres img为“使早餐加粗”时,午餐和晚餐不显示加粗文字

  img1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

            Intent iMenuList = new Intent(thirdstep.this,
                    fourthscreen.class);

            iMenuList.putExtra("Menuitem", txt1.getText().toString());

            startActivity(iMenuList);

        }
    });

    img2.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

            Intent iMenuList = new Intent(thirdstep.this,
                    fourthscreen.class);

            iMenuList.putExtra("Menuitem", txt2.getText().toString());

            startActivity(iMenuList);

        }
    });

    img3.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

            Intent iMenuList = new Intent(thirdstep.this,
                    fourthscreen.class);

            iMenuList.putExtra("Menuitem", txt3.getText().toString());

            startActivity(iMenuList);

        }
    });

}

  }


       public class fourthscreen extends Activity

            Breakfast = (TextView) findViewById(R.id.txtfourth1);
    Lunch = (TextView) findViewById(R.id.txtfourth2);
    Supper = (TextView) findViewById(R.id.txtfourth3);


         Bundle bundle = this.getIntent().getExtras();
     String param1 = bundle.getString("Menuitem");

                 Toast.makeText(fourthscreen.this, param1, Toast.LENGTH_LONG).show();
     if(param1.equalsIgnoreCase("BreakFast"))
     {
         Breakfast.setTypeface(null, Typeface.BOLD);
     }
     else 
         if(param1.equalsIgnoreCase("Lunch"))
         {
             Lunch.setTypeface(null, Typeface.BOLD);
         }
         else 
             if(param1.equalsIgnoreCase("Supper"))
             {
                 Lunch.setTypeface(null, Typeface.BOLD);
             }

试试默认的粗体,它在xml中对我有效,只需在TextView标记中写下以下行

android:textStyle="bold"

首先检查
stringparam1=bundle.getString(“Menuitem”)p*aram1*值,您是否只传递“早餐”、“午餐”和“晚餐”


txt1.getText().toString()=早餐txt2.getText().toString()=午餐Txt3.getText().toString()=在xmlis中使用android:textStyle=“bold”的Supperty 50%工作:午餐将不会b突出显示else if(param1.equalsIgnoreCase(“午餐”){breaken.setTypeface(null,Typeface.NORMAL);午餐.setTypeface(null,Typeface.BOLD);supply.setTypeface(null,Typeface.NORMAL);}当我按img2按钮时,AST将显示“午餐”,但午餐.txt将不显示b BOLD。我在json文件中发现问题,我在“午餐”午餐后的空白处:P)
android:textStyle="bold"
if(param1.equalsIgnoreCase("BreakFast"))
{
         Breakfast.setTypeface(null, Typeface.BOLD);
         Lunch.setTypeface(null, Typeface.NORMAL);
        Supper.setTypeface(null, Typeface.NORMAL);
}
else if(param1.equalsIgnoreCase("Lunch"))
{
         Lunch.setTypeface(null, Typeface.BOLD);
         Breakfast.setTypeface(null, Typeface.NORMAL);
        Supper.setTypeface(null, Typeface.NORMAL);
}
else if(param1.equalsIgnoreCase("Supper"))
{
        Supper.setTypeface(null, Typeface.BOLD);
        Lunch.setTypeface(null, Typeface.NORMAL);
        Breakfast.setTypeface(null, Typeface.NORMAL);
}