我有一个简单的布局结构:
DrawerLayout
\-- FrameLayout // @+id/fragment_container
\-- ListView // @+id/drawer_list
通过点击任何抽屉项,我使用FragmentTransaction.replace()
将相应的Fragment实例插入/替换到R.id.fragment_container
中。其中一个Fragment包含一个MapView
。
不同设备上都存在渲染问题,但同时DDMS向我展示了正确的截图。
已编辑
此问题出现在以下设备上:
- Huawei U9508,Android 4.0.4(API 15)
- HTC Desire A9191,Android 2.3.5(API 10)
以下设备没有问题:
- Samsung Galaxy S2,带有CyanogenMod Android 4.2.2(API 17)
- LG Google Nexus 4,Android 4.3(API 18)
有谁能帮我理解并解决这个问题吗?
请参见下面的图片:
Huawei U9508,Android 4.0.4(API 15)
HTC Desire A9191,Android 2.3.5(API 10)
DDMS
已编辑
活动布局:
<?xml version="1.0" encoding="utf-8"?>
<DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<!-- The main content view -->
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<!-- The navigation drawer -->
<ListView
android:id="@+id/drawer_list"
android:layout_width="240dp"
android:layout_height="match_parent"
android:orientation="vertical"
/>
</DrawerLayout>
碎片布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<!-- other views here -->
<com.google.android.gms.maps.MapView
android:id="@+id/consumer_profile_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>