我有一个相对做同样事情的 Clickable TextViews 列表。你点击它,它就会进入那个活动。设置转到设置活动。约到约等。除了这个重复的代码之外,还有更简单的方法来声明和设置这些可点击的 TextView 吗?
TextView create,
edit,
settings,
about;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_navigation);
create = (TextView) findViewById(R.id.create);
create.setTextColor(Color.parseColor("#000000"));
edit = (TextView) findViewById(R.id.edit);
edit.setTextColor(Color.parseColor("#000000"));
settings = (TextView) findViewById(R.id.settings);
settings.setTextColor(Color.parseColor("#000000"));
about = (TextView) findViewById(R.id.about);
about.setTextColor(Color.parseColor("#000000"));
create.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
}
});
edit.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
}
});
settings.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
}
});
about.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
}
});