map info icon

This commit is contained in:
Domagalski 2018-12-10 18:21:01 +01:00
parent fc428451a9
commit a6d4ef55d2

View File

@ -731,36 +731,18 @@ public class MapActivity extends BaseActivity
public void infoDialog(View anchorView) { public void infoDialog(View anchorView) {
View popupView = getLayoutInflater().inflate(R.layout.info_popup_map, null); View popupView = getLayoutInflater().inflate(R.layout.info_popup_map, null);
PopupWindow popupWindow = new PopupWindow(popupView, PopupWindow popupWindow = new PopupWindow(popupView,
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
// Example: If you have a TextView inside `popup_layout.xml`
// TextView tv = (TextView) popupView.findViewById(R.id.textViewAAA);
//
// tv.setText("aaaaa");
// Initialize more widgets from `popup_layout.xml`
// ....
// ....
// If the PopupWindow should be focusable // If the PopupWindow should be focusable
popupWindow.setFocusable(true); popupWindow.setFocusable(true);
// If you need the PopupWindow to dismiss when when touched outside // If you need the PopupWindow to dismiss when when touched outside
popupWindow.setBackgroundDrawable(new ColorDrawable()); popupWindow.setBackgroundDrawable(new ColorDrawable());
int location[] = new int[2]; int location[] = new int[2];
// Get the View's(the one that was clicked in the Fragment) location // Get the View's(the one that was clicked in the Fragment) location
anchorView.getLocationOnScreen(location); anchorView.getLocationOnScreen(location);
// Using location, the PopupWindow will be displayed right under anchorView // Using location, the PopupWindow will be displayed right under anchorView
popupWindow.showAtLocation(anchorView, Gravity.NO_GRAVITY, popupWindow.showAtLocation(anchorView, Gravity.NO_GRAVITY,
location[0], location[1] + anchorView.getHeight()); location[0] + anchorView.getWidth(), location[1] + anchorView.getHeight());
} }
} }