2017-08-25 13 views
0

J'ai suivi ce url link J'ai réussi à le faire mais la zone de texte ne répond pas au toucher. Je veux écrire dans cette zone de texte et obtenir l'emplacement. J'ai juste besoin de savoir comment faire pour que la zone de texte réponde à mon contact. Comment puis-je faire cela?TextBox sur MapFragment Cliquable

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="fill_parent" 
tools:context=""> 


<fragment xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:map="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/map" 
    android:name="com.google.android.gms.maps.SupportMapFragment" 
    android:layout_width="match_parent" 
    android:layout_height="fill_parent" 

    /> 
<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/ll" 
    android:orientation="horizontal" 
    android:layout_alignParentTop="true"> 
    <TextView 
     android:layout_width="300dp" 
     android:layout_height="50dp" 
     android:layout_margin="5dp" 
     android:background="@color/colorPrimary" 
     android:clickable="true" 
     /> 

</LinearLayout> 

+0

ajoutez-vous le onclicklistener à la vue? – ingyesid

+0

ne se contentera-t-il pas de répondre sans code java? –

+1

@ShubhamAgarwalBhewanewala textView ne répond pas sans le code Java. Je suppose que vous devez utiliser EditText ici, ce qui vous donnera l'option d'entrer une valeur – Arshad

Répondre

0
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_margin="5dp" 

     android:orientation="horizontal"> 

     <EditText 
      android:id="@+id/editText" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="4" 
      android:hint="Search Location Here" /> 


     <Button 
      android:id="@+id/search_button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.5" 
      android:onClick="onMapSearch" 
      android:text="Search" /> 

    </LinearLayout> 

    <fragment xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:id="@+id/map" 
     android:name="com.google.android.gms.maps.SupportMapFragment" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     tools:context="com.viralandroid.googlemapsandroidapi.MapsActivity" /> 

</LinearLayout> 

zone de texte sur MapFragment ..