0
我有一个方法如下,想从这个方法设置一个ActionBar标题,所以我可以访问“位置”。如何从baseAdapter中的getView方法设置ActionBar标题
@Override
public View getView(int position, View convertView, ViewGroup parent){
View songLay = convertView;
if (convertView == null) {
songLay = songInf.inflate(R.layout.chat, parent, false);
TextView body = (TextView) songLay.findViewById(R.id.msg_body);
Sms currSong = songs.get(position);
body.setText(currSong.getMsg());
}
songLay.setTag(position);
//new Chat().setTitle("lol");
return songLay;
}
编辑
中的onCreate里面我有这样的:
Sms currMsg = (Sms) msgList.get(1);
但那里是 “1”,应该在上述方法中的位置。
这可以在这里完成吗?如果是这样,我该如何去做呢?或者任何替代品?
你想干什么?为什么要将操作栏标题设置为*列表*?为什么你试图从getView方法中做到这一点,标题会不断变化滚动 –
?没有意义! – varunkr
@DavidMedenjak我想访问“位置”,我不知道如何从AppCompatActivity的onCreate访问它。我想在列表中单击每个项目时更改标题。 – Relm