我在充气地图时遇到问题。起初,如果我点击EditText
它会推出,如果我取消/ ok了AlertDialog.Builder
,然后再次单击EditText
就会造成:MapFragment充气通过EditText激活
E/MapError: android.view.InflateException: Binary XML file line #10: Error inflating class fragment
的逻辑是:我与地区进行,省。通过MapFragment
中的区域和省来设置所选区域的相机位置&省,这是除MapError之外唯一的问题。
我对Map
代码:
//START MAP FRAGMENT DIALOG
public void alertOrgMapSetMarker(){
LayoutInflater layoutInflater = getLayoutInflater();
View getView = layoutInflater.inflate(R.layout.map_inflate_org,null);
mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map_fragment_org);
AlertDialog.Builder alertMap = new AlertDialog.Builder(AdminCreateEventActivity.this,R.style.AlertDialogCustom);
alertMap.setTitle("Mark Location")
.setView(getView)
.setCancelable(false)
.setPositiveButton("Set", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog mapDialog = alertMap.create();
mapDialog.show();
}
我不能getView
从该行代码。为了控制。我想@Override -
setMapClickListener
mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map_fragment_org);
我的充气XML:map_inflate.xml
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"
android:id="@+id/map_fragment_org"
map:cameraBearing="112.5"
map:cameraTargetLat="10.3157"
map:cameraTargetLng="123.8854"
map:cameraTilt="45"
map:cameraZoom="30"
map:mapType="normal"
map:uiCompass="true"
map:uiRotateGestures="true"
map:uiScrollGestures="true"
map:uiTiltGestures="true"
map:uiZoomControls="true"
map:uiZoomGestures="true"
tools:ignore="MissingPrefix"/>
我真的需要你的帮助。谢谢。
是'AdminCreateEventActivity'延伸'FragmentActivity'或'简单Activity'? –
@M D:你正在考虑一个'SupportMapFragment'问题? – gus27
它'扩展'AppCompatActivity。 – RoCk