2016-03-23 13 views
1

私はこのような画面を作成しようとしています。これが私の設計目標です。AndroidのGoogleマップで他のレイアウトとビューを実装する

enter image description here

私はMapFragmentとともにRelativeLayoutを使用しています。しかし、これは次の画面のようには見えません。私はこれを正しい方法で行うためのあなたの提案に感謝します。ここに私のコードは...

<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> 

どのように私はこれを行うことができますか?

+1

ここにXMLコードを記入してください。あなたは今まで何をしていますか? –

+0

@SagarNayak私のXMLコードを追加しました。それを確認してください、または私に有用なリンクを提案することができます。 – anuradha

+0

は、マップを画面全体に表示させるために必要です。あなたの画面をいっぱいにしても、本当にそれを見ることができないからです。だから私はあなたが本当に目に見える限界に地図を保つことをお勧めします。 –

答えて

0

これらのビューでOnTouchListenerを使用している場合は、最後にtrueを返します。

0

ただ、例えば

android:clickable="true 

を追加し、あなたのTextViewのクリッカブルします

<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
  • は、あなたの内relativelayoutにIDを与えます。
  • レイアウトにクリックリスナーを設定します。アクティビティ -

    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. 
         } 
        }); 
    

    これで(あなたのXMLコードで)

<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) 

あなたの問題を解決します。

ご希望の場合は教えてください。

+0

こんにちは - ありがとうございます。私もデザインガイドが必要です。私はサンプル画像をアップロードしました。それが私のゴールデザインです。どうすればいいの? – anuradha

+0

私の答えはあなたのために働いたのですか? –

+0

まずこの答えをあなたのコードに実装して、それがうまくいけば教えてください。それからさらに進めることができます。 –

関連する問題