当前位置: 首页 > 知识库问答 >
问题:

Android谷歌地图不适用于幻灯片菜单

胡俊弼
2023-03-14

我有一个应用程序,使用gmap从webservice获取标记,并将其显示在地图上。这是一个很好的布局代码

<fragment
    xmlns:android="http://schemas.android.com/apk/res/android"
    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="com.example.hp.fakeyourlocation.map.LocationChooser">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:weightSum="10">
        <Switch
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/hotel"
            android:text="Hoteli"
            android:padding="10dp"
            android:layout_marginTop="20dp"
            android:paddingRight="10dp"/>
        <Switch
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/hostel"
            android:text="Hosteli"
            android:padding="10dp"
            android:layout_marginTop="20dp"
            android:paddingRight="10dp"/>
        <Switch
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/apartmani"
            android:text="Apartmani"
            android:padding="10dp"
            android:layout_marginTop="20dp"
            android:paddingRight="10dp"/>
    </TableRow>
        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:weightSum="10">
            <Switch
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/hotel1"
                android:text="Hoteli"
                android:padding="10dp"
                android:layout_marginTop="20dp"
                android:paddingRight="10dp"/>
            <Switch
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/hostel2"
                android:text="Hosteli"
                android:padding="10dp"
                android:layout_marginTop="20dp"
                android:paddingRight="10dp"/>
            <Switch
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/apartmani2"
                android:text="Apartmani"
                android:padding="10dp"
                android:layout_marginTop="20dp"
                android:paddingRight="10dp"/>
        </TableRow>
    </LinearLayout>
    <Button
        android:layout_width="100dp"
        android:layout_height="70dp"
        android:layout_gravity="center|bottom"
        android:id="@+id/button2"
        android:text="Show my current location"
        android:padding="10dp"/>
    <Switch
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/pocisti"
        android:layout_gravity="left|bottom"
        android:text="Ukloni oznake"
        android:padding="10dp"
        android:layout_marginTop="20dp"
        android:paddingRight="10dp"/>

    </fragment>

我想添加到幻灯片菜单,而不是主屏幕中的开关。一旦我将幻灯片菜单的代码添加到此文件的末尾,我可以看到幻灯片菜单,但谷歌地图停止工作。这是不起作用的新代码

<fragment
    xmlns:android="http://schemas.android.com/apk/res/android"
    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="com.example.hp.fakeyourlocation.map.LocationChooser">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:weightSum="10">
        <Switch
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/hotel"
            android:text="Hoteli"
            android:padding="10dp"
            android:layout_marginTop="20dp"
            android:paddingRight="10dp"/>
        <Switch
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/hostel"
            android:text="Hosteli"
            android:padding="10dp"
            android:layout_marginTop="20dp"
            android:paddingRight="10dp"/>
        <Switch
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/apartmani"
            android:text="Apartmani"
            android:padding="10dp"
            android:layout_marginTop="20dp"
            android:paddingRight="10dp"/>
    </TableRow>
        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:weightSum="10">
            <Switch
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/hotel1"
                android:text="Hoteli"
                android:padding="10dp"
                android:layout_marginTop="20dp"
                android:paddingRight="10dp"/>
            <Switch
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/hostel2"
                android:text="Hosteli"
                android:padding="10dp"
                android:layout_marginTop="20dp"
                android:paddingRight="10dp"/>
            <Switch
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/apartmani2"
                android:text="Apartmani"
                android:padding="10dp"
                android:layout_marginTop="20dp"
                android:paddingRight="10dp"/>
        </TableRow>
    </LinearLayout>
    <Button
        android:layout_width="100dp"
        android:layout_height="70dp"
        android:layout_gravity="center|bottom"
        android:id="@+id/button2"
        android:text="Show my current location"
        android:padding="10dp"/>
    <Switch
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/pocisti"
        android:layout_gravity="left|bottom"
        android:text="Ukloni oznake"
        android:padding="10dp"
        android:layout_marginTop="20dp"
        android:paddingRight="10dp"/>
    <android.support.v4.widget.DrawerLayout android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/drawer_layout" xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- As the main content view, the view below consumes the entire space available using match_parent in both dimensions. -->


    <FrameLayout android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/content_frame"/>

    <!-- android:layout_gravity="start" tells DrawerLayout to treat this as a sliding drawer on the left side for left-to-right languages and on the right side for right-to-left languages. The drawer is given a fixed width in dp and extends the full height of the container. A solid background is used for contrast with the content view. -->


    <ListView android:layout_height="match_parent" android:layout_width="240dp" android:id="@+id/left_drawer" android:background="#111" android:dividerHeight="0dp" android:divider="@android:color/transparent" android:choiceMode="singleChoice" android:layout_gravity="start"/>

</android.support.v4.widget.DrawerLayout>
    </fragment>

任何关于结合谷歌地图和幻灯片菜单的帮助

地图活动

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CompoundButton;
import android.widget.ListView;
import android.widget.Switch;
import android.widget.TextView;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

import java.util.ArrayList;
import java.util.List;

public class MapsActivity extends FragmentActivity {

    private GoogleMap mMap; // Might be null if Google Play services APK is not available.

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_maps);
        ListView drawerView = (ListView) findViewById(R.id.left_drawer);

        List<String> switches = new ArrayList<String>();
        switches.add("Switch 1");
        switches.add("Switch 2");
        switches.add("Switch 3");

        ListAdapter adapter = new ListAdapter(this, R.layout.itemlistrow, switches);
        drawerView.setAdapter(adapter);
    }

    @Override
    protected void onResume() {
        super.onResume();
        setUpMapIfNeeded();
    }

    /**
     * Sets up the map if it is possible to do so (i.e., the Google Play services APK is correctly
     * installed) and the map has not already been instantiated.. This will ensure that we only ever
     * call {@link #setUpMap()} once when {@link #mMap} is not null.
     * <p/>
     * If it isn't installed {@link SupportMapFragment} (and
     * {@link com.google.android.gms.maps.MapView MapView}) will show a prompt for the user to
     * install/update the Google Play services APK on their device.
     * <p/>
     * A user can return to this FragmentActivity after following the prompt and correctly
     * installing/updating/enabling the Google Play services. Since the FragmentActivity may not
     * have been completely destroyed during this process (it is likely that it would only be
     * stopped or paused), {@link #onCreate(Bundle)} may not be called again so we should call this
     * method in {@link #onResume()} to guarantee that it will be called.
     */
    private void setUpMapIfNeeded() {
        // Do a null check to confirm that we have not already instantiated the map.
        if (mMap == null) {
            // Try to obtain the map from the SupportMapFragment.
            mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                    .getMap();
            // Check if we were successful in obtaining the map.
            if (mMap != null) {
                setUpMap();
            }
        }
    }

    /**
     * This is where we can add markers or lines, add listeners or move the camera. In this case, we
     * just add a marker near Africa.
     * <p/>
     * This should only be called once and when we are sure that {@link #mMap} is not null.
     */
    private void setUpMap() {
        mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));
    }

    public class ListAdapter extends ArrayAdapter<String> {
        public ListAdapter(Context context, int textViewResourceId) {
            super(context, textViewResourceId);
        }

        public ListAdapter(Context context, int resource, List<String> items) {
            super(context, resource, items);
        }

        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            View v = convertView;

            if (v == null) {
                LayoutInflater vi;
                vi = LayoutInflater.from(getContext());
                v = vi.inflate(R.layout.itemlistrow, null);
            }

            String p = getItem(position);

            if (p != null) {
                TextView tt1 = (TextView) v.findViewById(R.id.name);
                Switch switchI = (Switch) v.findViewById(R.id.value);

                if (tt1 != null) {
                    tt1.setText(p);
                }

                switchI.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                        switch (position) {
                            case 1:
                                // TODO: Behaviour of switchI on first row
                                break;
                            case 2:
                                // TODO: Behaviour of switchI on second row
                                break;
                            default:
                                // TODO: Default behaviour
                                break;
                        }
                    }
                });
            }
            return v;
        }
    }
}

活动地图。xml

<android.support.v4.widget.DrawerLayout
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:id="@+id/drawer_layout"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- As the main content view, the view below consumes the entire space available using match_parent in both dimensions. -->


    <FrameLayout android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/content_frame"/>

    <!-- android:layout_gravity="start" tells DrawerLayout to treat this as a sliding drawer on the left side for left-to-right languages and on the right side for right-to-left languages. The drawer is given a fixed width in dp and extends the full height of the container. A solid background is used for contrast with the content view. -->
    <ListView
        android:layout_height="match_parent"
        android:layout_width="140dp"
        android:id="@+id/left_drawer"
        android:background="#111"
        android:dividerHeight="0dp"
        android:divider="@android:color/transparent"
        android:choiceMode="singleChoice"
        android:layout_gravity="start"/>
    <fragment
    xmlns:android="http://schemas.android.com/apk/res/android"
    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="com.example.hp.fakeyourlocation.map.LocationChooser">

    <Button
        android:layout_width="100dp"
        android:layout_height="70dp"
        android:layout_gravity="center|bottom"
        android:id="@+id/button2"
        android:text="Show my current location"
        android:padding="10dp"/>
    <Switch
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/pocisti"
        android:layout_gravity="left|bottom"
        android:text="Ukloni oznake"
        android:padding="10dp"
        android:layout_marginTop="20dp"
        android:paddingRight="10dp"/>


    </fragment>
    </android.support.v4.widget.DrawerLayout>

itemlistrow。xml

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:paddingBottom="10dp"
    android:paddingLeft="20dp"
    android:paddingRight="20dp"
    android:paddingTop="10dp">

    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_marginRight="15dp"
        android:gravity="center_vertical"
        android:textColor="#fff"/>

    <Switch
        android:id="@+id/value"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:textColor="#fff"/>

</LinearLayout>

共有1个答案

扶冠宇
2023-03-14

根据文件:

要添加抽屉菜单,请将带有DrawerLayout对象的用户交互界面声明为布局的根视图。在DrawerLayout中,添加一个包含屏幕主要内容的视图(抽屉隐藏时的主要布局)和另一个包含抽屉菜单内容的视图。

因此,android.support.v4.widget.DrawerLayout必须是根视图(在您的情况下,您只需在现有xml的末尾添加它)。

这是一个带有map和DrawerLayout的工作xml示例:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <ListView
        android:id="@+id/left_drawer"
        android:layout_width="300dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:choiceMode="singleChoice"
        android:divider="@android:color/transparent"
        android:dividerHeight="0dp"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"/>

</android.support.v4.widget.DrawerLayout>

更新:一个简单的示例,使用上面的答案和来自列表视图自定义适配器的拟议代码来说明如何创建带有开关的左抽屉:

活动地图。xml

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.MapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <ListView
        android:id="@+id/left_drawer"
        android:layout_width="300dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="#000"
        android:choiceMode="singleChoice"
        android:divider="@android:color/transparent"
        android:dividerHeight="0dp"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"/>

</android.support.v4.widget.DrawerLayout>

itemlistrow。xml

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:paddingBottom="10dp"
    android:paddingLeft="20dp"
    android:paddingRight="20dp"
    android:paddingTop="10dp">

    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_marginRight="15dp"
        android:gravity="center_vertical"
        android:textColor="#fff"/>

    <Switch
        android:id="@+id/value"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:textColor="#fff"/>

</LinearLayout>

地图活动性。Java语言

public class MapsActivity extends FragmentActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_maps);

        ListView drawerView = (ListView) findViewById(R.id.left_drawer);

        List<String> switches = new ArrayList<String>();
        switches.add("Switch 1");
        switches.add("Switch 2");
        switches.add("Switch 3");

        ListAdapter adapter = new ListAdapter(this, R.layout.itemlistrow, switches);
        drawerView.setAdapter(adapter);
    }

    public class ListAdapter extends ArrayAdapter<String> {
        public ListAdapter(Context context, int textViewResourceId) {
            super(context, textViewResourceId);
        }

        public ListAdapter(Context context, int resource, List<String> items) {
            super(context, resource, items);
        }

        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            View v = convertView;

            if (v == null) {
                LayoutInflater vi;
                vi = LayoutInflater.from(getContext());
                v = vi.inflate(R.layout.itemlistrow, null);
            }

            String p = getItem(position);

            if (p != null) {
                TextView tt1 = (TextView) v.findViewById(R.id.name);
                Switch switchI = (Switch) v.findViewById(R.id.value);

                if (tt1 != null) {
                    tt1.setText(p);
                }

                switchI.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                        switch (position) {
                            case 1:
                                // TODO: Behaviour of switchI on first row
                                break;
                            case 2:
                                // TODO: Behaviour of switchI on second row
                                break;
                            default:
                                // TODO: Default behaviour
                                break;
                        }
                    }
                });
            }
            return v;
        }
    }
}

UPDATE:xml,每行有两个开关

itemlistrow。xml

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:paddingBottom="10dp"
    android:paddingLeft="20dp"
    android:paddingRight="20dp"
    android:paddingTop="10dp">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_weight="1">

        <TextView
            android:id="@+id/name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="15dp"
            android:gravity="center_horizontal"
            android:text="SW1"
            android:textColor="#fff"/>

        <Switch
            android:id="@+id/value"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clickable="true"
            android:textColor="#fff"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_weight="1">

        <TextView
            android:id="@+id/name2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="15dp"
            android:gravity="center_horizontal"
            android:text="SW2"
            android:textColor="#fff"/>

        <Switch
            android:id="@+id/value2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clickable="true"
            android:textColor="#fff"/>

    </LinearLayout>

</LinearLayout>

或者,删除TextViews并使用Switch的文本属性:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:paddingBottom="10dp"
    android:paddingLeft="20dp"
    android:paddingRight="20dp"
    android:paddingTop="10dp">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_weight="1">

        <Switch
            android:id="@+id/value"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="SW1"
            android:clickable="true"
            android:textColor="#fff"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_weight="1">

        <Switch
            android:id="@+id/value2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="SW2"
            android:clickable="true"
            android:textColor="#fff"/>

    </LinearLayout>

</LinearLayout>

修改MapsActive以在上面的同一行视图上使用两个开关(警告:未完全html" target="_blank">测试):

public class MapsActivity extends FragmentActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_maps);

        ListView drawerView = (ListView) findViewById(R.id.left_drawer);

        List<RowItem> switches = new ArrayList<RowItem>();
        switches.add(new RowItem("Hotels", "Hostels");
        switches.add(new RowItem("Camps", "Private");

        ListAdapter adapter = new ListAdapter(this, R.layout.itemlistrow, switches);
        drawerView.setAdapter(adapter);
    }

    public class ListAdapter extends ArrayAdapter<RowItem> {
        public ListAdapter(Context context, int textViewResourceId) {
            super(context, textViewResourceId);
        }

        public ListAdapter(Context context, int resource, List<RowItem> items) {
            super(context, resource, items);
        }

        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            View v = convertView;

            if (v == null) {
                LayoutInflater vi;
                vi = LayoutInflater.from(getContext());
                v = vi.inflate(R.layout.itemlistrow, null);
            }

            RowItem p = getItem(position);

            if (p != null) {
                TextView tt1 = (TextView) v.findViewById(R.id.name);
                Switch switchI1 = (Switch) v.findViewById(R.id.value);
                TextView tt2 = (TextView) v.findViewById(R.id.name2);
                Switch switchI2 = (Switch) v.findViewById(R.id.value2);

                tt1.setText(p.getSwitch1Name());
                tt2.setText(p.getSwitch2Name());

                switchI1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                        switch (position) {
                            case 0:
                                // TODO: Behaviour of switchI1 on first row
                                break;
                            case 1:
                                // TODO: Behaviour of switchI1 on second row
                                break;
                            default:
                                // TODO: Default behaviour
                                break;
                        }
                    }
                });

                switchI2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                        switch (position) {
                            case 0:
                                // TODO: Behaviour of switchI2 on first row
                                break;
                            case 1:
                                // TODO: Behaviour of switchI2 on second row
                                break;
                            default:
                                // TODO: Default behaviour
                                break;
                        }
                    }
                });
            }
            return v;
        }
    }

    private class RowItem {
        private String switch1Name;
        private String switch2Name;

        public RowItem(String switch1Name, String switch2Name) {
            this.switch1Name = switch1Name;
            this.switch2Name = switch2Name;
        }

        public String getSwitch1Name() {
            return switch1Name;
        }

        public String getSwitch2Name() {
            return switch2Name;
        }
    }
}
 类似资料:
  • 我是xamarin的新手,我需要在应用程序中放置谷歌地图。 我已经从xamarin下载了示例: https://github.com/xamarin/monodroid-samples/tree/master/MapsAndLocationDemo_v2 经过一些改变,它工作了,这个项目显示地图。 以下是工作的项目的代码: /MainActivity.cs/ /BasicDemo.axml/ /A

  • 我有问题加载一个谷歌地图在我的片段。一切都从一个循环器视图适配器开始,该适配器启动活动“ViatGedetAllViewActivity”: 这是我的DetallViewActivity: =2 03-24 02:55:53.881 639-7362/com.example.usuari.MyApplication3 w/ResourcesManager:GetTopleVelResources:

  • 所以我看到了一个特殊的例外,我敢肯定的是谷歌地图的绘图代码。 我有一个片段,在那里我以编程方式添加了一个支持地图片段,然后我在其中操纵谷歌地图实例。 这是stacktrace: 我无法可靠地复制它(尽管这种情况经常发生),我已经查看了ReadWriteDirectByteBuffer和ShortToByteBufferAdapter,但没有任何东西突然出现在我面前。 有什么想法吗?

  • 使用幻灯片组件,你需要在 sm.js 和 sm.css 之后额外引入如下两个文件: <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm-extend.min.css"> <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm-exte

  • 我的logcat显示: 任何帮助都将不胜感激!谢谢!

  • 本文向大家介绍Android实现幻灯片式图片浏览器,包括了Android实现幻灯片式图片浏览器的使用技巧和注意事项,需要的朋友参考一下 我们来实现一个幻灯片式图片浏览器: 最下面一个画廊视图,选中画廊中的图片,会在上面的ImageSwitcher控件中显示大图。 效果图如图 实现方法: 在布局文件中添加图片切换控件ImageSwitcher和画廊视图控件Gallery res/layout/mai