如何在标记的标题中显示用户数据(例如其性别或姓名)并将其转换为图像。还有,如果用户是男性,如何将用户的标记图标自定义为图像,我希望我的标记在地图上显示男性图标。我尝试了以下代码来标记标题
public View getInfoContents(Marker marker) {
View view = getLayoutInflater().inflate(R.layout.activity_custominfowindow,null);
auth = FirebaseAuth.getInstance();
currentUserId = auth.getCurrentUser().getUid();
userinfo = FirebaseDatabase.getInstance().getReference().child("Users").child(currentUserId);
userinfo.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
if(dataSnapshot.child("gender").getValue().toString().equals("Male")){
ImageView usergender = (ImageView) view.findViewById(R.id.user_gender);
usergender.setImageResource(marker.setTitle(String.valueOf(usergender)););
}