2016-03-23 4 views
1

Ich versuche, einen Bildschirm wie diesen zu erstellen. Das ist mein Designziel.Implementieren anderer Layouts und Ansichten auf Google Map in Android

enter image description here

Ich verwende RelativeLayout zusammen mit dem MapFragment. Aber das sieht nicht wie der folgende Bildschirm aus. Ich schätze Ihre Vorschläge, dies in der richtigen Weise zu tun. Hier ist mein Code ...

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

<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="match_parent" 
    tools:context="gps.finder.com.findermaterial.MapsActivity" /> 


     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="200dip" 
      android:layout_alignParentBottom="true" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true" 
      android:background="#c8e6c9"> 

      <TextView 
       android:id="@+id/details" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:maxLines="3" 
       android:padding="8dp" 
       android:text="Card View" 
       android:textColor="#222" 
       android:textStyle="bold" 
       android:textSize="22dp" /> 

      <TextView 
       android:id="@+id/title" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/details" 
       android:maxLines="3" 
       android:padding="8dp" 
       android:text="Card View" 
       android:textColor="#222" 
       android:textStyle="bold" 
       android:textSize="22dp" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/title" 
       android:maxLines="3" 
       android:padding="8dp" 
       android:text="description" 
       android:textColor="#666" 
       android:textSize="14dp" /> 

     </RelativeLayout> 

</RelativeLayout> 

Kann mir jemand sagen, wie kann ich das tun?

+1

poste deinen XML-Code hier. was hast du bis jetzt gemacht? –

+0

@SagarNayak Ich habe meinen XML-Code hinzugefügt. Bitte überprüfen Sie es oder Sie können mir nützliche Links vorschlagen. – anuradha

+0

ist dies notwendig, damit Ihre Karte den gesamten Bildschirm ausfüllt. Denn selbst wenn es Ihren Bildschirm füllt, können Sie es nicht wirklich sehen. Also schlage ich vor, dass Sie die Karte bis zum Limit halten, wo sie wirklich sichtbar ist. –

Antwort

0

Wenn Sie OnTouchListener für diese Ansichten verwenden, geben Sie am Ende nur true zurück.

0

einfach Ihre TextView s klickbare

android:clickable="true 

Zum Beispiel das Hinzufügen machen:

<TextView 
    android:id="@+id/details" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:maxLines="3" 
    android:padding="8dp" 
    android:text="Card View" 
    android:textColor="#222" 
    android:textStyle="bold" 
    android:textSize="22dp" 
    android:clickable="true" /> 
0
  • eine ID zu Ihrer inneren relativelayout geben.
  • Legen Sie einen Clicklistener zu Ihrem Layout.

Beispiel

(in XML-Code)

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

<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="match_parent" 
tools:context="gps.finder.com.findermaterial.MapsActivity" /> 


    <RelativeLayout 
     android:id="@+id/container_layout" 
     android:layout_width="match_parent" 
     android:layout_height="200dip" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     android:background="#c8e6c9"> 

     <TextView 
      android:id="@+id/details" 
      android:layout_width="wrap_content" 
..... 
..... (this is your remaining xml) 

in maßnahmen

findViewById(R.id.container_layout).setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View v) { 
      //leave this empty. or you can write some functionality here. 
     } 
    }); 

diese wird dein Problem lösen.

Bitte lassen Sie mich wissen, wenn dies das ist, was Sie wollen.

+0

Hallo - danke für deine Antwort. Ich brauche auch einen Design Guide. Ich habe ein Beispielbild hochgeladen und das ist mein Zieldesign. Können Sie mir bitte sagen, wie das geht? – anuradha

+0

hat meine Antwort für Sie funktioniert? –

+0

zuerst implementieren Sie diese Antwort in Ihrem Code und lassen Sie mich wissen, ob es funktioniert hat. dann können wir weitermachen. –