Android listView的一行中的SuportMapFragment

Android listView的一行中的SuportMapFragment,android,google-maps,android-listview,expandablelistview,Android,Google Maps,Android Listview,Expandablelistview,我有一个活动,在每个单元格中都有一个ExpandableListView,我想显示一个带有alfinet.Vou的映射,请发布我的代码和我遇到的错误 在我看来: public class Main extends FragmentActivity { ..... private void refreshListView ( ) { ListAdapterDetalhes ListAdapterDetalhes adapter = new (this, items

我有一个活动,在每个单元格中都有一个ExpandableListView,我想显示一个带有alfinet.Vou的映射,请发布我的代码和我遇到的错误

在我看来:

public class Main extends FragmentActivity {
    .....
    private void refreshListView ( ) {
        ListAdapterDetalhes ListAdapterDetalhes adapter = new (this, items ) ;
        list.setAdapter ( adapter ) ;
    }
    .....

}
我的适配器:

@覆盖
公共视图getChildView(int groupPosition,final int childPosition,
布尔值isLastChild、视图转换视图、视图组父级){
对象内容=getChild(groupPosition,childPosition);
//Mostra célula com o文本视图
if(content.getClass().equals(String.class)){
convertView=充气机。充气(R.layout.item_detalhes_texto,空);
TextView descripao=(TextView)convertView.findViewById(R.id.item_descripao_establecimento);
descripcao.setText((字符串)内容);
}
//Mostra tabela com os Telefone,电子邮件e o站点
else if(content.getClass().equals(Contato.class)){
convertView=充气机。充气(右布局。项目详细信息,空);
列表itens=Util.testaCamposContato((Contato)内容,活动);
ListView列表=(ListView)convertView.findViewById(R.id.listContato);
ListAdapterContato适配器=新的ListAdapterContato(itens,活动);
list.setAdapter(适配器);
//重新启动列表视图
Util.setListViewHeightBasedOnChildren(列表);
}
//Mostra a célula com o endereço mapa
else if(content.getClass().equals(Endereco.class)){
convertView=充气机。充气(R.layout.item_detalhes_endereco,空);
TextView textEndereco=(TextView)convertView.findViewById(R.id.item\u texto\u endereco);
Endereco Endereco=(Endereco)内容;
字符串strengdereco=“+endereco.getLogradouro()+”,“+endereco.getNumero()
+“\n”+endereco.getBairro()+“\n”+endereco.getCep()
+“\n”+endereco.getComplemento()
+“\n”+endereco.getCidade().getNome()+“-RS/Brasil”;
textEndereco.setText(strengdereco);
//验证谷歌播放服务是否可以使用
int status=GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity.getBaseContext());
//这是一个关于通知的警告
如果(status!=ConnectionResult.SUCCESS){//Google Play服务不可用
Util.alerta(Util.getString(R.string.S0x0001,活动)、Util.getString(R.string.S0x0044,活动)、活动);
Log.e(“ERRO”,“谷歌游戏问题”);
}else{//Google play服务estáinstalado,mostra o pino no mapa
//莫斯特拉·皮诺·马帕·库德纳斯
这个.populate_映射(endereco.getLatitude(),endereco.getLongitude(),
endereco.getGenericEstab().getNome(),null,
R.drawable.pizzarias,18岁,活动,convertView);
}
}
}
/**
*作为合作伙伴的皮诺·科姆(pino-com)的修正案
*无地图视图
*/
公共空白填充图(双lat、双lng、字符串标题、字符串描述、,
int图标、int缩放、上下文、视图v){
//Atribui ID para o地图视图
//获取对activity_main.xml的SupportMapFragment的引用
SupportMapFragment fm=(SupportMapFragment)((FragmentActivity)上下文).getSupportFragmentManager().findFragmentById(R.id.mapDetalhes);
GoogleMap=fm.getMap();
map.setMyLocationEnabled(true);
addMarker(新的MarkerOptions()
.位置(新LatLng(lat,lng))
.头衔(头衔)
.代码段(说明)
.图标(位图描述符工厂)
.fromResource(图标));
//将相机立即移动到汉堡,变焦为15。
移动相机(CameraUpdateFactory.newLatLngZoom(新LatLng(lat,lng),zoom));
//放大,设置摄影机动画。
map.animateCamera(CameraUpdateFactory.zoomTo(zoom),2000,空);
}

XML地址详细信息(单元格)


我的代码很复杂,因为它是一个适配器,根据对象的类型显示布局,一切正常,如果要使用地图的布局,我会得到以下错误:

02-12 11:37:55.674 11799-11799/com.mobsolution.turismogaribaldi E/AndroidRuntime﹕ 致命异常:主 android.view.InflateException:二进制XML文件行#32:膨胀类片段时出错 位于android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697) 位于android.view.LayoutInflater.rInflate(LayoutInflater.java:739) 位于android.view.LayoutInflater.rInflate(LayoutInflater.java:742) 在android.view.LayoutInflater.充气(LayoutInflater.java:489) 在android.view.LayoutInflater.inflate(LayoutInflater.java:396) 在android.view.LayoutInflater.充气(LayoutInflater.java:352) 在genericestab.listapterdetalhes.getChildView(listapterdetalhes.java:150) 位于android.widget.ExpandableListConnector.getView(ExpandableListConnector.java:455) 在android.widget.AbsListView.obtainView(AbsListView.java:2464) 在android.widget.ListView.measureHeightOChildren(ListView.java:1250)上 在android.widget.ListView.onMeasure(ListView.java:1161)上 在android.view.view.measure(view.java:12842) 位于android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:594) 在android.widget.RelativeLayout.onMeasure(RelativeLayout.java:376)上 在android.view.view.measure(view.java:12842) 在android.widget.RelativeLayout.measureChild(RelativeLayout.java:579) 在android.widget.RelativeLayout.onMeasure(RelativeLayout.java:392)上 在android.view.view.measure(V
    @Override
    public View getChildView(int groupPosition, final int childPosition,
                             boolean isLastChild, View convertView, ViewGroup parent) {
        Object content = getChild(groupPosition, childPosition);

        // Mostra célula com o text View
        if(content.getClass().equals(String.class)){
            convertView = inflater.inflate(R.layout.item_detalhes_texto, null);

            TextView descricao = (TextView)convertView.findViewById(R.id.item_descricao_estabelecimento);
            descricao.setText((String)content);

        }
        // Mostra tabela com os Telefones, Emails e o site
        else if(content.getClass().equals(Contato.class)){

            convertView = inflater.inflate(R.layout.item_detalhes_contato, null);
            List<ItemContato> itens = Util.testaCamposContato((Contato)content,activity);
            ListView list = (ListView)convertView.findViewById(R.id.listContato);
            ListAdapterContato adapter = new ListAdapterContato(itens,activity);
            list.setAdapter(adapter);

            // Redimenciona listView
            Util.setListViewHeightBasedOnChildren(list);


        }
        // Mostra a célula com o endereço e o mapa
        else if(content.getClass().equals(Endereco.class)){
            convertView = inflater.inflate(R.layout.item_detalhes_endereco, null);

            TextView textEndereco = (TextView)convertView.findViewById(R.id.item_texto_endereco);
            Endereco endereco = (Endereco)content;
            String strEndereco = ""+endereco.getLogradouro() + ", " +endereco.getNumero()
                    +"\n" + endereco.getBairro() + "\n" + endereco.getCep()
                    +"\n" + endereco.getComplemento()
                    +"\n" + endereco.getCidade().getNome() + " - RS / Brasil";

            textEndereco.setText(strEndereco);

            // Verifica se o Google play services está instalado no aparelho do usuário
            int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity.getBaseContext());

            // Se não estiver mostra um alerta de notificação
            if(status != ConnectionResult.SUCCESS){ // Google Play Services are not available
                Util.alerta(Util.getString(R.string.S0x0001, activity), Util.getString(R.string.S0x0044, activity), activity);
                Log.e("ERRO", "google play problem");

            }else { // Google play Services está instalado, mostra o pino no mapa
                //Mostra pino no mapa com as coordenaas 
                this.populate_map(endereco.getLatitude(),endereco.getLongitude(),
                                  endereco.getGenericEstab().getNome(),null,
                                  R.drawable.pizzarias,18,activity,convertView);
            }
        }
}

/**
 * Fixa o pino com as coordenadas e faz todos ajustes necessários
 * no MapView
 */
public void populate_map( double lat, double lng, String title, String description,
                         int icon, int zoom, Context context, View v){
    //Atribui ID para o MapView
    // Getting reference to the SupportMapFragment of activity_main.xml
    SupportMapFragment fm = (SupportMapFragment) ((FragmentActivity)context).getSupportFragmentManager().findFragmentById(R.id.mapDetalhes);
    GoogleMap map = fm.getMap();

    map.setMyLocationEnabled(true);
    map.addMarker(new MarkerOptions()
            .position(new LatLng(lat, lng))
            .title(title)
            .snippet(description)
            .icon(BitmapDescriptorFactory
                    .fromResource(icon)));

    // Move the camera instantly to hamburg with a zoom of 15.
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), zoom));

    // Zoom in, animating the camera.
    map.animateCamera(CameraUpdateFactory.zoomTo(zoom), 2000, null);

}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:id="@+id/root">

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


        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:text="Endereço"
            android:id="@+id/item_texto_endereco"
            android:textSize="14sp"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:layout_marginTop="10dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginBottom="10dp"/>



        <fragment
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/mapDetalhes"
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginBottom="10dp"
            android:layout_below="@+id/item_texto_endereco"
            class="com.google.android.gms.maps.SupportMapFragment"
           />

    </RelativeLayout>

</LinearLayout>