我正在尝试在对话框中显示地图(使用LovelyDialog)
我想要的是将地图添加到FrameLayout但我得到了
java.lang.IllegalArgumentException: No view found for id 0x7f0d00ab for fragment SupportMapFragment{c2cd779 #1 id=0x7f0d00ab}
但是,当我使用DialogFragment
这是我的代码:
Dialog show = new LovelyCustomDialog(this)
.setTopColorRes(R.color.yellow)
.setIcon(R.drawable.ic_menu_camera)
.setView(R.layout.fragment_maps)
.configureView(new LovelyCustomDialog.ViewConfigurator() {
@Override
public void configureView(final View v) {
FrameLayout mapContainer= (FrameLayout) v.findViewById(R.id.mapView);
SupportMapFragment fragment = new SupportMapFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.add(mapContainer.getId(), fragment).commit();
}
})
.show();
这是我的布局文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/relativeLayoutMain"
android:padding="0dp" >
<FrameLayout
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
</RelativeLayout>