我正在尝试在Play商店中进行相同的标签布局.我必须使用来自androidhive的片段和viewpager来显示标签布局.但是,我无法在其上实现谷歌地图v2.我已经在互联网上搜索了好几个小时,但我找不到如何做的教程.有人可以告诉我怎么样?
我已经将android SDK更新为5.0,而我之前的项目没有使用它(它在4.4.2中正常工作).
我有一个扩展片段的类
public class MapFragment extends Fragment{
//
}
Run Code Online (Sandbox Code Playgroud)
在这个课程中,我用google support mapfragment夸大了一个布局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_tile_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible" >
<RelativeLayout
android:id="@+id/full_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
<Textview
<!-- dfh
fgh -->
/>
</RelativeLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
当我在我的代码中执行此操作时,它返回null
SupportMapFragment fragment = (SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map);
Run Code Online (Sandbox Code Playgroud)
在Android4.4.2中这条线路对我有用,但在更新后有一些问题......
有没有人找到解决方案......