【问题标题】:Showing a custom dialog after tapping on map marker点击地图标记后显示自定义对话框
【发布时间】:2012-09-18 22:23:34
【问题描述】:

点击地图标记后,我试图在我的地图应用程序中显示自定义对话框。这是我的代码 onTap(int index) 根据 Android 开发人员指南,它不起作用。这里有什么问题?请帮忙!

@Override
    protected boolean onTap(int index) {
        // TODO Auto-generated method stub
          OverlayItem item = mOverlays.get(index);
          Context mContext = getApplicationContext();
          Dialog dialog = new Dialog(mContext);
          dialog.setContentView(R.layout.marker_view);
          dialog.setTitle(item.getTitle());
          TextView textAddress = (TextView) dialog.findViewById(R.id.tv_marker_address);
          TextView textPhone = (TextView)  dialog.findViewById(R.id.tv_marker_phone);
          textAddress.setText(item.getSnippet());
          ImageView image = (ImageView)  dialog.findViewById(R.id.marker_image); 
          dialog.show();
          Button btn = (Button)dialog.findViewById(R.id.btn1);
          btn1.setOnClickListener(this);
          return true;
    }
}

【问题讨论】:

  • 请在 LogCat 中显示错误
  • 没有错误。只是视图没有出现。
  • 请出示您的 R.layout.marker_view 布局

标签: android google-maps dialog


【解决方案1】:

也许你需要先膨胀布局?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-06-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-05
    相关资源
    最近更新 更多