在我的第四課堂選擇的文本將不會顯示粗體只有早餐會顯示粗體午餐和晚餐不是鞋大膽當我按img2或img3告訴我我會做什麼?所有值顯示在吐司,但只有當PRES IMG是做早餐會大膽午餐和晚餐沒有表現出不maketext大膽大膽在我的代碼textview不顯示大膽我該怎麼辦?
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);
}
txt1.getText()的toString()=早餐txt2.getText()的toString()=午餐 – user2644835
txt3.getText()的toString()= SUPPER – user2644835
嘗試使用安卓。TEXTSTYLE = 「黑體」在XML – Sunny