在android中将mapview添加到选项卡中
我在互联网上搜索过教程之类的东西,但我还没有找到任何有效的解决方案,所以我想,为什么不在这里问一下呢???我已经设法在选项卡外使用了地图视图,但是如何在地图选项卡内显示xml呢?请提前回复并感谢! 我需要在“地图”选项卡上添加地图视图,我该怎么做???这是我用于选项卡的XML代码:在android中将mapview添加到选项卡中,android,xml,map,tabs,android-mapview,Android,Xml,Map,Tabs,Android Mapview,我在互联网上搜索过教程之类的东西,但我还没有找到任何有效的解决方案,所以我想,为什么不在这里问一下呢???我已经设法在选项卡外使用了地图视图,但是如何在地图选项卡内显示xml呢?请提前回复并感谢! 我需要在“地图”选项卡上添加地图视图,我该怎么做???这是我用于选项卡的XML代码: <?xml version="1.0" encoding="utf-8"?> <TabHost android:layout_width="fill_parent" android:layout_
<?xml version="1.0" encoding="utf-8"?>
<TabHost android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/tabHost"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<TabWidget
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@android:id/tabs"
/>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@android:id/tabcontent"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/tab1"
android:orientation="vertical"
android:paddingTop="60px"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="100px"
android:text="My tracks"
android:id="@+id/txt1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/tab2"
android:orientation="vertical"
android:paddingTop="60px"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="100px"
android:text="Map"
android:id="@+id/txt2"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/tab3"
android:orientation="vertical"
android:paddingTop="60px"
>
<TextView
android:id="@+id/txt3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Search for gokart tracks" />
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="@+id/SearchInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="10.05" >
<requestFocus />
</EditText>
<Button
android:id="@+id/SearchButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@android:string/search_go" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
</TabHost>
我有一个项目,在
选项卡中有一个地图视图
以下是选项卡的来源和布局:
|
以下是在选项卡中加载的MapView的源和布局:
|
我希望你能为自己的项目修改这段代码,祝你好运 你试过把它加进去吗?这里有说明:是的,试过了。但没有成功…尝试过,但问题是:它只是显示另一个窗口,而没有在“地图”选项卡中显示地图。这就是问题所在。顺便说一句,非常感谢代码运行得很好,我添加了一张运行时的图片。代码太远了,无法通过代码孔,但是你能给我发一个在选项卡中显示xml布局文件的代码吗?