lvRSS = (ListView)findViewById (R.id.lvRSS)
lvRSS.setOnItemClickListener (new AdapterView.OnItemClickListener(){
public void onItemClick (AdpaterView<?>parent,View view, int position,
long id)
}
它将在listview上工作,但我无法模仿工具栏上的
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setOnItemClickListener (new AdapterView.OnItemClickListener(){
public void onItemClick (AdpaterView<?>parent,View view, int
position, long id)
}
请帮助
答案 0 :(得分:1)
工具栏不包含setOnItemClickListener()事件。如果要使事件单击工具栏,请尝试以下操作:
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});