在我的第四课堂选择的文本将不会显示粗体只有早餐会显示粗体午餐和晚餐不是鞋大胆当我按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