//所有笔记都来源网络,都自己编码成功过的
//如有错误欢迎指正,如有更优解欢迎讨论
1. 获取view的子view
public void onClick(View v) {
LinearLayout ll = (LinearLayout) findViewById(v.getId()); //最外面那层,也就是v
RelativeLayout rl = (RelativeLayout) ll.getChildAt(0); //v内部的RelativeLayout
TextView tv = (TextView) rl.getChildAt(0);//RelativeLayout 内部的TextView
}
要验证对不对:
if (tv.getId() == R.id.c501_tag) { //c501_tag就是我在xml文件中给TextView取的id
System.out.println("tv==c501_tag");
}
结果:
2.页面跳转:
//跳转界面
Intent intent = new Intent(this, infoActivity.class);
intent.putExtra("uid", id);
intent.putExtra("upwd", psw);
startActivity(intent);