我现在有个textview,下面有个imageview,我现在根据手指在imageview中的不同位置(onTouch事件监听)在textview里面设置不同的数字,可是会出现内容覆盖,谁知道该咋办啊
解决方案 »
- android项目中,数据库复制问题
- 有一个值他无时无刻都在赋值,赋的值也没有规律,怎么让现在的值 和500毫秒以后的值进行比较啊?
- 始终无法接收到广播 请高手帮忙
- android开发,如何将高一版本的android程序转换成低版本的?
- 求助一个关于Android输入法中的问题
- 调用lockCanvas问题
- android中通过SimpleCursorAdapter绑定的Listview能不能手动增加一行?
- gridview里item的变换
- 求助!: 安卓手机浏览器不能通过电脑hosts映射的域名访问web程序
- 用Drawable.createFromStream(url).openStream()得到的drawable对象可以直接显示在image控件中吗
- 哪位大侠用过在linux虚拟机上编译android源代码,帮帮忙!!!
- 关于android模拟器IP问题?
只要你你每次都是使用同一个TextView对象的话,我觉得应该是不会出现覆盖的情况的。
public class iTravoLuncherMoreFlowActivity extends Activity { private Button clearBut;
private Button posiBut;
private ButtonListener listener;
private EditText pswText;
private Dialog dialog;
private RelativeLayout luncher_more_flow_relative;
private TextView dateView1;
private TextView dateView2;
private TextView dateView3;
private ProgressBar bar1;
private ProgressBar bar2;
private ProgressBar bar3;
private TextView outView1;
private TextView outView2;
private TextView outView3;
private TextView in1;
private TextView in2;
private TextView in3; private Handler handler = new MyHandler();
private class MyHandler extends Handler{
public void handleMessage(Message msg) {
switch (msg.what) {
case 1:
clearData();
break;
}
super.handleMessage(msg);
}
}
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.luncher_more_flow); luncher_more_flow_relative = (RelativeLayout) this.findViewById(R.id.luncher_more_flow_relative);
dateView1 = (TextView) this.findViewById(R.id.luncher_more_flow_date1);
dateView2 = (TextView) this.findViewById(R.id.luncher_more_flow_date2);
dateView3 = (TextView) this.findViewById(R.id.luncher_more_flow_date3);
bar1 = (ProgressBar) this.findViewById(R.id.luncher_more_flow_downloadbar1);
bar2 = (ProgressBar) this.findViewById(R.id.luncher_more_flow_downloadbar2);
bar3 = (ProgressBar) this.findViewById(R.id.luncher_more_flow_downloadbar3);
outView1 = (TextView) this.findViewById(R.id.luncher_more_flow_out1);
outView2 = (TextView) this.findViewById(R.id.luncher_more_flow_out2);
outView3 = (TextView) this.findViewById(R.id.luncher_more_flow_out3);
in1 = (TextView) this.findViewById(R.id.luncher_more_flow_in1);
in2 = (TextView) this.findViewById(R.id.luncher_more_flow_in2);
in3 = (TextView) this.findViewById(R.id.luncher_more_flow_in3);
initData();
listener = new ButtonListener();
clearBut = (Button) this.findViewById(R.id.luncher_more_flow_clearBut);
clearBut.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { View view = LayoutInflater.from(
iTravoLuncherMoreFlowActivity.this).inflate(
R.layout.luncher_more_flow_dialog, null);
dialog = new Dialog(iTravoLuncherMoreFlowActivity.this);
dialog.setTitle("Please Input Password:");
dialog.setContentView(view);
dialog.show();
pswText = (EditText) view.findViewById(R.id.luncher_more_flow_dialog_edittext);
Button posiBut = (Button) view
.findViewById(R.id.luncher_more_flow_dialog_posiBut);
Button negBut = (Button) view
.findViewById(R.id.luncher_more_flow_dialog_negBut); posiBut.setOnClickListener(listener);
negBut.setOnClickListener(listener); }
});
} private void initData() { dateView1.setText("2011-1-27");
dateView2.setText("2011-1-27");
dateView3.setText("2011-1-27");
outView1.setText("0s(0)|0s");
outView2.setText("55|79");
outView3.setText("17.99MB|17.99MB");
in1.setText("5:59(14)|7:39");
in2.setText("0|0");
in3.setText("0MB|0MB");
} private void clearData() { dateView1.destroyDrawingCache();
dateView1.setText("");
dateView2.setText(" ");
dateView3.setText(" ");
dateView1.invalidate();
bar1.setProgress(0);
bar2.setProgress(0);
bar3.setProgress(0);
outView1.setText(" ");
outView2.setText(" ");
outView3.setText(" ");
in1.setText(" ");
in2.setText(" ");
in3.setText(" ");
}
private class ButtonListener implements View.OnClickListener { public void onClick(View v) {
switch (v.getId()) {
case R.id.luncher_more_flow_dialog_posiBut:
String psw = pswText.getText().toString();
if("54250".equals(psw)){
Message message = new Message();
message.what = 1;
handler.sendMessage(message);
dialog.dismiss();
}else{
Toast.makeText(iTravoLuncherMoreFlowActivity.this, "密码有误,请重新输入!", 1).show();
}
break; case R.id.luncher_more_flow_dialog_negBut:
dialog.dismiss();
break;
}
}
}
}
dateView1.setTextColor(Color.RED);
dateView1.setText("DABABABAB");
dateView1.setTextColor(Color.YELLOW);
他会始终显示最后设的文字(这里是黄色的字),但是initData()里面设置的内容始终位于最底层,这是为啥呢,我老大说可能是textview或其容器缓存的原因~~~~,我也用了dateView1.destroyDrawingCache();可结果还是一样啊,大家有什么解决办法吗