你好我有TextView的问题.这是我的代码
final TextView username = (TextView) _v.findViewById(R.id.username);
final LinearLayout linear7 = (LinearLayout) _v.findViewById(R.id.linear7);
final TextView date = (TextView) _v.findViewById(R.id.date);
final TextView msg = (TextView) _v.findViewById(R.id.msg);
final TextView username2 = (TextView) _v.findViewById(R.id.username);
final LinearLayout linear72 = (LinearLayout) _v.findViewById(R.id.linear7);
final TextView date2 = (TextView) _v.findViewById(R.id.date);
final TextView msg2 = (TextView) _v.findViewById(R.id.msg);
final LinearLayout linear999 = (LinearLayout) _v.findViewById(R.id.linear999);
final LinearLayout linear9992 = (LinearLayout) _v.findViewById(R.id.linear9992);
username.setText(map1.get((int)_position).get("name").toString());
msg.setText(map1.get((int)_position).get("msg").toString());
date.setText(map1.get((int)_position).get("date").toString());
username2.setText(username.getText().toString());
msg2.setText(msg.getText().toString());
date2.setText(date.getText().toString());
Run Code Online (Sandbox Code Playgroud)
如您所见,username2应与用户名具有相同的文本.但是,它只有我在设计师中为它提供的文本.请帮忙.
小智 6
看看你的id TextView它是一样的.将其更改为第二个连接的IDTextView
final TextView msg = (TextView) _v.findViewById(R.id.msg);
final TextView msg2 = (TextView) _v.findViewById(R.id.msg); <--- change this ID
Run Code Online (Sandbox Code Playgroud)
final TextView username = (TextView) _v.findViewById(R.id.username);
final TextView username2 = (TextView) _v.findViewById(R.id.username);
Run Code Online (Sandbox Code Playgroud)
他们有相同的视图ID.您必须更改username2视图ID.
| 归档时间: |
|
| 查看次数: |
87 次 |
| 最近记录: |