2013-06-21 52 views
0

我在這裏看到了很多這個問題的答案,但沒有一個解決我的問題。我試圖做一個選項卡布局,我有哪些文本是文本視圖在表格佈局和下面的表格佈局我想添加地圖。我試圖做到這一點,但沒有得到結果。 加入我得到這個錯誤的MapView後,我的錯誤是不幸的應用程序停止工作:無法在當前主題中找到樣式'mapViewStyle'

Failed to find style 'mapViewStylr' in current theme 

。當我在Nexus上運行代碼並嘗試打開添加MapView的佈局時,應用程序不幸停止。

這裏是我的佈局代碼

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 
    android:background="@android:color/white" 
    > 
<ScrollView 
    android:id="@+id/info_tab" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    > 

<RelativeLayout 
    android:id="@+id/venuinfolayout" 
    android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:background="@android:color/white" > 

<TableLayout 
    android:id="@+id/venuetable" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:fitsSystemWindows="true" 
    android:weightSum="2" 
    > 
<TableRow 
    android:layout_width="fill_parent"  
    android:layout_height="wrap_content"   
    android:layout_weight="1"> 

    <TextView 
     android:id="@+id/venueaddress" 
     android:text="Address:" 
     android:textColor="@android:color/black" 
     android:padding="6dip" 
     android:textStyle="bold" 
     android:textSize="20dip" /> 

    <TextView 
     android:id="@+id/venueaddress_details" 
     android:layout_height="wrap_content" 
     android:layout_width="180dip" 
     android:singleLine="false" 
     android:layout_toRightOf="@id/venueaddress" 
     android:textColor="@android:color/black" 
     android:text="text" 
     android:layout_marginLeft="10dip" 
     android:padding="6dip" 
     android:textSize="15dip" 
     /> 

    </TableRow> 

<TableRow 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_weight="1"> 


    <TextView 
     android:id="@+id/venuephone" 
     android:layout_below="@id/venueaddress" 
     android:text="Phone:" 
     android:textColor="@android:color/black" 
     android:padding="6dip" 
     android:textStyle="bold" 
     android:textSize="20dip" /> 

    <TextView 
     android:id="@+id/venuephone_details" 
     android:layout_below="@id/venueaddress_details" 
     android:layout_toRightOf="@id/venuephone" 
     android:text="number" 
     android:textColor="@android:color/black" 
     android:layout_marginLeft="10dip" 
     android:padding="6dip" 
     android:textSize="15dip" /> 
</TableRow> 
</TableLayout> 

<com.google.android.maps.MapView 
    android:id="@+id/mapview" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_below="@id/venuetable" 
    android:clickable="true" 
    android:apiKey="AIzaSyAvWazTUUQr88b_UqQvB4k5rPAtOhlxTFA" /> 


</RelativeLayout> 
</ScrollView> 
</RelativeLayout> 
+0

'com.google.android.maps.MapView'是棄用谷歌地圖API的Android V1的一部分。如果您沒有生成調試和發佈API密鑰,請考慮切換到API v2(您不會有API v1顯示地圖)。 –

+0

我生成了API密鑰。但仍然無法正常工作。 –

回答

0

我有同樣的問題,當我嘗試建立一個簡單的應用程序,以下Android的MapView的教程。

這個應用程序顯示此異常AVD的文件main.xml文件:

Failed to find style 'mapViewStyle' in current theme 

最後我發現有文件AndroidManifest.xml中的錯誤:

的元素應該是元素的孩子,不是馬上在內。

希望這對你有所幫助。

OR

look Here

+0

我檢查一下我的AndroidManifest.xml裏面有沒有什麼是正確的。 –

+0

任何人都可以說如何在linux終端中使用ant builder構建。我是一個Linux用戶。 –

+0

對不起...很難說linux終端... upvote –

0
//try this it may help you 

Add this into your manifest file 

<uses-library android:name="com.google.android.maps" /> 
+0

我已經在我的清單文件中。仍然得到谷歌地圖api v1的錯誤 –

+0

API密鑰從谷歌地圖不贊成。目前您無法通過google maps api v1開發您的mapview應用程序。 – Nas

相關問題