问题已经解决,之前写成了 tabUnReadMsg.setText(count);
setText方法里面应该传入string类型的字串,而不是传int型字串 public void updateTabUnReadMsg(int which,int count) { if(count <= 0){ return; } View v = tabsContainer.getChildAt(which); if (v instanceof TextView) { Log.i("wangqx", "287 updateTabUnReadMsg"); } else if (v instanceof ViewGroup) { mWhich = which; Log.i("wangqx", "326 count="+count); mCount = count; Log.i("wangqx", "289 updateTabUnReadMsg"); TextView tabUnReadMsg = (TextView) v.findViewById(R.id.tv_unreadmsg); Log.i("wangqx", "291 updateTabUnReadMsg"); tabUnReadMsg.setVisibility(View.VISIBLE); Log.i("wangqx", "293 updateTabUnReadMsg"); tabUnReadMsg.setText(String.valueOf(count)); }