获取此错误android.view.InflateException:二进制XML文件行#2:错误导致类<unknown>

时间:2015-07-22 14:54:57

标签: android xml android-layout android-fragments maps

Android One 的新用户在主布局中添加线段布局片段后面临此错误。在使用<“>片段正常工作之前,使用5.5”设备测试应用程序。

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#flip3D{ width:240px; height:200px; margin:10px; float:left; }
#flip3D > #front{
position:absolute;
transform: perspective( 600px ) rotateY( 0deg );
background:#FC0; width:240px; height:200px; border-radius: 7px;
backface-visibility: hidden;
transition: transform .5s linear 0s;}
#flip3D > #back{
position:absolute;
transform: perspective( 600px ) rotateY( 180deg );
background: #80BFFF; width:240px; height:200px; border-radius: 7px;
backface-visibility: hidden;
transition: transform .5s linear 0s;}
</style>
<script>
function flip(el){
el.children[1].style.transform = "perspective(600px) rotateY(-180deg)";
el.children[0].style.transform = "perspective(600px) rotateY(0deg)";}
var vlib = document.getElementById('front');
vlib.addEventListener(click, flip(el));
</script>
<title>Flashcards</title>
</head>
<body>
<div id="flip3D">
  <div id="back">Box - Back</div>
  <div id="front">Box - Front </div>
</div>
</body>
</html>

这是我的新线性布局

07-22 19:48:01.775  28504-28504/com.milkywaygalaxy.mymaps E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.milkywaygalaxy.mymaps, PID: 28504
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.milkywaygalaxy.mymaps/com.milkywaygalaxy.mymaps.MapsActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2247)
        at android.app.ActivityThread.access$800(ActivityThread.java:141)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5050)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:806)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
        at dalvik.system.NativeStart.main(Native Method)

这是我的主要活动java代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@string/verical_margin"
android:paddingLeft="@string/horizondal_margin"
android:paddingRight="@string/horizondal_margin"
android:paddingTop="@string/verical_margin" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="start|center_vertical"
        android:text="@string/location"
        android:textSize="20sp" />

    <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center|center_vertical"
        android:ems="10" >

        <requestFocus />
    </EditText>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end|center_vertical"
        android:text="@string/go"
        android:onClick="geoLocate"/>
</LinearLayout>

<fragment
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="fill_parent" />

</LinearLayout>

在开发者模式下在设备上运行此应用时,显示不幸的应用已停止。请告诉我任何建议或解决方案。提前谢谢。

0 个答案:

没有答案