2013-04-19 13 views
5

में मेरे कस्टम इन्फोविंडो लेआउट की चौड़ाई को अनदेखा किया गया है, मेरे कस्टम इन्फोविंडो लेआउट में सेट की गई चौड़ाई को अनदेखा किया जाता है (यह हमेशा मेल_पैरेंट होता है)।Google कस्टम एंड्रॉइड एपीआई v2

क्या मुझे कुछ याद आ रही है?

mMap.setInfoWindowAdapter(new InfoWindowAdapter() { 

    @Override 
    public View getInfoWindow(Marker arg0) { 
     return null; 
    } 

    @Override 
    public View getInfoContents(Marker arg0) { 

     View v = getActivity().getLayoutInflater().inflate(R.layout.info_window_layout, null); 

     // set my custom data 

     return v; 

    } 
}); 

info_window_layout.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="100dp" 
    android:layout_height="50dp" 
    android:padding="5dp" > 

    <!-- some custom stuff --> 

</RelativeLayout> 
+0

के अनुसार चौड़ाई डीपी chnage जाहिर है यह सिर्फ RelativeLayouts के साथ एक समस्या है। LinearLayouts बस ठीक काम करते हैं। इसलिए मैंने लाइनरलायआउट में अपना लेआउट दोबारा लिखने के साथ समाप्त कर दिया। सौभाग्य से यह काफी सरल था इसलिए यह एक बड़ी समस्या नहीं थी। – Ridcully

उत्तर

0

मैं यह वास्तव में wrap_content किया जाएगा लगता है।

जिस तरह से जानकारी विंडो काम करता है वह आपके व्यू को बिटमैप पर खींचकर और किसी अन्य व्यू ग्रुप के अंदर नहीं डाल रहा है। layout_xxx का उपयोग मूल दृश्य द्वारा किया जाता है।

आपके रिलेवेटिवआउट के कुछ या सभी बच्चों पर इन मानों को हार्डकोड करने से शायद आपकी समस्या हल हो जाएगी।

0

getInfoWindow में इस का उपयोग करने का प्रयास करें, getInfoContents लौट अशक्त:

<LinearLayout 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical" 
      android:background="@drawable/transparent"> 

     <LinearLayout 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:gravity="center_horizontal" 
       android:orientation="vertical"> 

      <!-- some custom stuff --> 

     </LinearLayout> 
    </LinearLayout> 
0
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_gravity="center_horizontal" 
android:background="#8BC34A" 
android:orientation="vertical" 
android:paddingBottom="@dimen/small_padding" 
android:paddingLeft="@dimen/very_samll_padding" 
android:paddingRight="@dimen/very_samll_padding" 
android:paddingTop="@dimen/small_padding"> 


<LinearLayout 
    android:layout_width="320dp" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 

    <TextView 
     android:id="@+id/tv_address" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textColor="@color/white" /> 

    <LinearLayout 
     android:id="@+id/ll_latlong" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/tv_address" 
     android:layout_marginTop="@dimen/very_samll_padding" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/tv_lat" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical" 
      android:textColor="@color/white" /> 

     <View 
      android:layout_width="1dp" 
      android:layout_height="12dp" 
      android:layout_gravity="center_vertical" 
      android:layout_marginLeft="@dimen/small_padding" 
      android:layout_marginRight="@dimen/small_padding" 
      android:background="@color/white" /> 

     <TextView 
      android:id="@+id/tv_long" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical" 
      android:textColor="@color/white" /> 

    </LinearLayout> 
</LinearLayout> 

बस अपने requiremnt के

संबंधित मुद्दे