每次点击我的标记时,我都会尝试更改textView文本。但是textView没有改变文本。日志显示文本,但显示setText 没有工作
public boolean onMarkerClick(Marker marker) {
Halte h = arrayListHalte.get(Integer.parseInt(marker.getSnippet()));
Log.d(TAG, "onMarkerClick: " + h.getNamaHalte());
tvNamaHalte.setText(h.getNamaHalte());
mBottomSheet.setState(BottomSheetBehavior.STATE_EXPANDED);
fab.hide();
return false;
}
这是我的oncreate
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
setSupportActionBar(myToolbar);
tvNamaHalte = (TextView) findViewById(R.id.nama_bs);// i get my textView from bottomSheet
}
答案 0 :(得分:0)
只需更改代码,然后尝试...
public boolean onMarkerClick(Marker marker) {
Halte h = arrayListHalte.get(Integer.parseInt(marker.getSnippet()));
Log.d(TAG, "onMarkerClick: " + h.getNamaHalte());
mBottomSheet.setState(BottomSheetBehavior.STATE_EXPANDED);
tvNamaHalte.setText(h.getNamaHalte());
fab.hide();
return false;
}