5

Ho una finestra popup che viene visualizzata quando faccio clic su un indicatore di mappa. PopupWindow consente all'utente di cambiare la posizione del Marker e selezionare un raggio attorno ad esso. Se imposto focusable true, posso interagire con PopupWindow ma non con la mappa. E, se imposto il focusable falso, stranamente, posso interagire con SeekBar su PopupWindow ma né i Buttons, né i EditText rispondono, ma posso interagire con la mappa.Impossibile interagire con PopupWindow e Background (GoogleMap)

Domanda: Come posso fare in modo che l'Utente possa interagire sia con PopupWindow sia con la mappa nello stesso momento?

 <LinearLayout android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:orientation="vertical"> 

      <TextView android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/event" 
       android:textAppearance="?android:attr/textAppearanceMedium" /> 

      <EditText android:id="@+id/markerEventNameEditText" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:ems="10" 
       android:hint="@string/your_event_name" 
       android:inputType="text" /> 

      <LinearLayout android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

       <TextView android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="@string/radius" 
        android:textAppearance="?android:attr/textAppearanceMedium" /> 

       <TextView android:id="@+id/radiusTextView" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceSmall" /> 
      </LinearLayout> 

      <SeekBar android:id="@+id/radiusSeekBar" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="10dp" /> 

      <LinearLayout android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

       <Button android:id="@+id/editEventButton" 
        android:layout_width="0px" 
        android:layout_height="wrap_content" 
        android:layout_weight="1" 
        android:text="@string/edit_event" /> 

       <Button android:id="@+id/cancelMarkerWindowButton" 
        android:layout_width="0px" 
        android:layout_height="wrap_content" 
        android:layout_weight="1" 
        android:text="@string/close" /> 
      </LinearLayout> 
     </LinearLayout> 

     <TableLayout android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical"> 

      <TableRow android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:gravity="center"> 

       <ImageButton android:id="@+id/ImageButton03" 
        android:layout_width="50dp" 
        android:layout_height="50dp" 
        android:layout_gravity="center" 
        android:src="@drawable/arrow_1" /> 
      </TableRow> 

      <TableRow android:layout_width="wrap_content" 
       android:layout_height="wrap_content"> 

       <ImageButton android:id="@+id/ImageButton01" 
        android:layout_width="50dp" 
        android:layout_height="50dp" 
        android:src="@drawable/arrow_1"/> 

       <ImageButton android:id="@+id/ImageButton02" 
        android:layout_width="50dp" 
        android:layout_height="50dp" 
        android:src="@drawable/arrow_1"/> 
      </TableRow> 

      <TableRow android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:gravity="center"> 

       <ImageButton android:id="@+id/imageButton1" 
        android:layout_width="50dp" 
        android:layout_height="50dp" 
        android:src="@drawable/arrow_1" /> 
      </TableRow> 
     </TableLayout> 
    </LinearLayout> 
    <View android:layout_width="match_parent" 
     android:layout_height="3dp" 
     android:background="@color/WhiteSmoke" /> 

//Constructor 
    public MarkerPopupWindow(Marker edited_event_marker,Context context) 
    { 
     LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
     View markerWindowView = inflater.inflate(R.layout.event_editor_popup_window, null, false); 
     markerWindowView.findViewById(R.id.cancelMarkerWindowButton); 

     int height = ViewGroup.LayoutParams.WRAP_CONTENT; 
     int width = ViewGroup.LayoutParams.MATCH_PARENT; 
     PopupWindow markerWindow = new PopupWindow(markerWindowView, 
       width,height, 
       false); //Focusable, if false window cannot be touched. 
     markerWindow.setWindowLayoutMode(width, height); 
     //Called these methods (commented out) attempting to fix the problem without success. 
     //markerWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED); 
     //markerWindow.setSoftInputMode(PopupWindow.INPUT_METHOD_NEEDED); 
     //markerWindow.setOutsideTouchable(true); 
     markerWindow.showAtLocation(findViewById(R.id.location_tab_container), Gravity.TOP, 0, 0); 
    } 
+0

Ciao, hai trovato qualche soluzione sulla finestra pop-up che mostra il marcatore click – Dory

risposta

1

Il modo in cui il fare con il popup è che o la mappa o la comparsa possono avere messa a fuoco, se si vuole essere in grado di spostare la mappa con il popup aperto Penso che potrebbe essere necessario avere il popup dalla mappa delle API, proprio come mostra le mappe di google quando si fa clic su un marker.

Per ulteriori informazioni sul popup (chiamato InfoWindow in Maps API) si può andare here

+0

L'InfoWindow non funziona perché non è live view – Garzahd

+0

è un'istantanea di una vista. Quindi non avrei modo di distinguere tra diversi eventi di clic. PopupWindow ha 6 pulsanti, una SeekBar e un EditText. – Garzahd

+0

Quindi non capisco perché è necessario essere in grado di spostare la mappa con il popup aperto, con questi pulsanti non lascerebbe molto spazio per una mappa su un telefono. –