Android 地图自定义信息 window 在 Clusterer 底部有方框形状
Android Map Custom info window with box shape on bottom in Clusterer
我需要为我的 android 应用程序制作自定义信息 window;像下面。请看下图。
用户单击标记时会显示此信息 window。它可以根据标记位置显示在地图顶部或地图底部。
我不知道要做这个。我探索了 Whosebug,许多创建自定义信息的方法 windows,但是对于这个,我在这里没有找到任何解决方案。那么,有人可以告诉我如何构建它吗?
您应该进行自定义布局。
<FrameLayout>
....
<MapFragment/>
<FrameLayout (match_parent, match_parent) ... android:id="@+id/my_info_window_wrapper"/>
<LinearLayout...
android:id="@+id/my_info_window"
android:visibility = "gone">
<ImageView../>
<TextView../>
</LinearLayout>
</FrameLayout >
并在代码中
mViewWrapper.setOnClickListener(new OnClickLister{
mView.setVisibility(View.GONE);
)};
GoogleMap.setOnMarkerClickListener(new OnMarkerClickListener{
mView.setVisibility(View.VISIBLE);
)};
您可以通过此代码以编程方式自定义 window..onClick 您的按钮
LayoutInflater inflater = LayoutInflater.from(this);
final Dialog dialog1 = new Dialog(this);
Window window = dialog1.getWindow();
WindowManager.LayoutParams wlp = window.getAttributes();
wlp.gravity = Gravity.BOTTOM; // Here you can set window top or bottom
wlp.flags &= ~WindowManager.LayoutParams.FLAG_DIM_BEHIND;
window.setAttributes(wlp);
View view1 = inflater.inflate(R.layout.openYourWindow, null);
dialog1.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog1.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog1.setContentView(view1);
dialog1.show();
我需要为我的 android 应用程序制作自定义信息 window;像下面。请看下图。
用户单击标记时会显示此信息 window。它可以根据标记位置显示在地图顶部或地图底部。
我不知道要做这个。我探索了 Whosebug,许多创建自定义信息的方法 windows,但是对于这个,我在这里没有找到任何解决方案。那么,有人可以告诉我如何构建它吗?
您应该进行自定义布局。
<FrameLayout>
....
<MapFragment/>
<FrameLayout (match_parent, match_parent) ... android:id="@+id/my_info_window_wrapper"/>
<LinearLayout...
android:id="@+id/my_info_window"
android:visibility = "gone">
<ImageView../>
<TextView../>
</LinearLayout>
</FrameLayout >
并在代码中
mViewWrapper.setOnClickListener(new OnClickLister{
mView.setVisibility(View.GONE);
)};
GoogleMap.setOnMarkerClickListener(new OnMarkerClickListener{
mView.setVisibility(View.VISIBLE);
)};
您可以通过此代码以编程方式自定义 window..onClick 您的按钮
LayoutInflater inflater = LayoutInflater.from(this);
final Dialog dialog1 = new Dialog(this);
Window window = dialog1.getWindow();
WindowManager.LayoutParams wlp = window.getAttributes();
wlp.gravity = Gravity.BOTTOM; // Here you can set window top or bottom
wlp.flags &= ~WindowManager.LayoutParams.FLAG_DIM_BEHIND;
window.setAttributes(wlp);
View view1 = inflater.inflate(R.layout.openYourWindow, null);
dialog1.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog1.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog1.setContentView(view1);
dialog1.show();