Карта не отображается правильно в Android MapView - PullRequest
1 голос
/ 20 февраля 2012

Я показываю с помощью MapView, но когда я меняю вид, используя методы

map_view.setStreetView(true);
map_view.setSatellite(false);

Моя карта показывает белые квадратные прямоугольники на карте. Как и

enter image description here

Iне понимаю, почему это происходит?Любая идея, пожалуйста, помогите.

Мой XML-макет является

<FrameLayout android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <RelativeLayout android:layout_width="match_parent"
            android:layout_height="match_parent">

            <com.google.android.maps.MapView
                android:id="@+id/map" android:layout_width="match_parent"
                android:layout_height="match_parent" android:apiKey="0zkSIDXrbRRAbgiBkpRyxVR-5WWN6Jce_Sed6AQ"
                android:clickable="true" />
        </RelativeLayout>

        <FrameLayout android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true" android:layout_gravity="bottom">
            <LinearLayout android:layout_width="fill_parent"
                android:paddingTop="0dip" android:layout_height="40dip" android:id="@+id/linearLayout3"
                android:layout_gravity="center_horizontal" android:paddingBottom="0dip"
                android:background="@drawable/ttitle_bar">

                <RadioGroup android:layout_width="match_parent"
                    android:id="@+id/rgMap" android:layout_height="match_parent"
                    android:orientation="horizontal" android:layout_marginTop="5dip"
                    android:layout_marginLeft="10dip" android:checkedButton="@+id/rbtnMapSetManualLocOnMap">
                    <RadioButton android:layout_width="100dip"
                        android:layout_height="30dip" android:layout_marginRight="0dip"
                        android:gravity="center" android:id="@+id/rbtnMapSetManualLocOnMap"
                        android:button="@drawable/radio_selector_map" />
                    <TextView android:layout_width="2dip"
                        android:layout_height="30dip" />

                    <RadioButton android:layout_marginLeft="0dip"
                        android:layout_marginRight="0dip" android:layout_width="100dip"
                        android:layout_height="30dip" android:gravity="center"
                        android:id="@+id/rbtnSetteliteSetManulaLocOnMap" android:button="@drawable/radio_selector_setellite" />
                    <TextView android:layout_width="0.5dip"
                        android:layout_height="30dip" />

                    <RadioButton android:layout_marginLeft="0dip"
                        android:layout_width="100dip" android:layout_height="30dip"
                        android:gravity="center" android:id="@+id/rbtnHybridSetManulaLocOnMap"
                        android:button="@drawable/radio_selector_hybrid" />
                </RadioGroup>
            </LinearLayout>
        </FrameLayout>
    </FrameLayout>

РЕДАКТИРОВАТЬ Я использовал три RadioButton, который переключает представления. На самом деле я хотел изменить вид на гибридный вид, вид карты и вид со спутника.

Так что мой метод изменения вида:

@Override
    public void onCheckedChanged(RadioGroup group, int checkedId)
    {
        // TODO Auto-generated method stub
        switch (checkedId)
        {
        case R.id.group_purchasing_on_map_radiobtn_map:
             map_view.setStreetView(true);
            map_view.setSatellite(false);
            break;
        case R.id.group_purchasing_on_map_radiobtn_hybrid:
             map_view.setStreetView(true);
            map_view.setSatellite(true);
            break;
        case R.id.group_purchasing_on_map_radiobtn_satellite:
             map_view.setStreetView(false);
             map_view.setSatellite(true);
            break;
        }
    }

1 Ответ

0 голосов
/ 18 марта 2012

У меня точно такая же проблема, и у меня нет никакой логики на моей карте, просто покажи ее в streetView. Я подумал, что это как-то связано с элементами управления масштабированием, когда я их отключил, он начинает работать. Нам, конечно, нужны элементы управления масштабированием, поэтому было бы неплохо найти реальное решение.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...