2016-08-17 8 views
1

TextViewGoogleMapに入れようとしています。これまでに書いた以下のコードを見てください。私がそれを実行するとTextViewGoogleMapに表示されません。Googleマップでtextviewを表示します。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context=".activity.HomeActivity" 
    tools:showIn="@layout/app_bar_main"> 

    <LinearLayout 
     android:id="@+id/validity" 
     android:layout_width="match_parent" 
     android:layout_height="50dp" 
     android:orientation="vertical" 
     android:layout_alignParentBottom="true"> 
     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="You are not a paid user."/> 
    </LinearLayout> 

    <fragment 
     android:id="@+id/home_map" 
     android:name="com.google.android.gms.maps.SupportMapFragment" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="false" 
     android:layout_alignParentStart="true" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentBottom="true" /> 

</RelativeLayout> 

この問題を解決するには、解決策を提案してください。

+0

回答を得ました – DKV

+0

回答を得ましたか? – Rahul

答えて

3

使用でframeLayout。私はこれを試して、これは動作しています

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior"> 
    <fragment 
     android:id="@+id/home_map" 
     android:name="com.google.android.gms.maps.SupportMapFragment" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_alignParentLeft="false" 
     android:layout_alignParentStart="true" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentBottom="true" /> 
    <LinearLayout 
     android:id="@+id/validity" 
     android:layout_width="match_parent" 
     android:layout_height="50dp" 
     android:orientation="vertical" 
     android:layout_gravity="bottom" 
     android:background="@android:color/white"> 
     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="You are not a paid user." 
      /> 
    </LinearLayout> 



</FrameLayout> 
+0

はいこれが有効です。おかげで – anuradha

+0

@ Vivek Mishra upvoted – anuradha

2

使用このコードの代わりに、このような相対的なレイアウトの

<fragment 
    android:id="@+id/home_map" 
    android:name="com.google.android.gms.maps.SupportMapFragment" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="false" 
    android:layout_alignParentStart="true" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentBottom="true" /> 
<LinearLayout 
    android:id="@+id/validity" 
    android:layout_width="match_parent" 
    android:layout_height="50dp" 
    android:orientation="vertical" 
    android:layout_alignParentBottom="true"> 
    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="You are not a paid user."/> 
</LinearLayout> 

関連する問題