0
我正在開發一個應用程序在Android平臺上使用vuforia。 我想用兩個按鈕在相機饋送上添加疊加視圖,但會出現這些錯誤。覆蓋查看相機飼料與按鈕Android和vuforia
10-14 09:53:41.422: E/AndroidRuntime(2584): FATAL EXCEPTION: main
10-14 09:53:41.422: E/AndroidRuntime(2584): java.lang.ClassCastException: android.widget.ToggleButton cannot be cast to android.widget.ImageView
10-14 09:53:41.422: E/AndroidRuntime(2584): at com.qualcomm.QCARSamples.VideoPlayback.VideoPlayback.setupStartScreen(VideoPlayback.java:963)
10-14 09:53:41.422: E/AndroidRuntime(2584): at com.qualcomm.QCARSamples.VideoPlayback.VideoPlayback.access$12(VideoPlayback.java:927)
10-14 09:53:41.422: E/AndroidRuntime(2584): at com.qualcomm.QCARSamples.VideoPlayback.VideoPlayback$3.run(VideoPlayback.java:881)
10-14 09:53:41.422: E/AndroidRuntime(2584): at android.os.Handler.handleCallback(Handler.java:730)
10-14 09:53:41.422: E/AndroidRuntime(2584): at android.os.Handler.dispatchMessage(Handler.java:92)
10-14 09:53:41.422: E/AndroidRuntime(2584): at android.os.Looper.loop(Looper.java:137)
10-14 09:53:41.422: E/AndroidRuntime(2584): at android.app.ActivityThread.main(ActivityThread.java:5103)
10-14 09:53:41.422: E/AndroidRuntime(2584): at java.lang.reflect.Method.invokeNative(Native Method)
10-14 09:53:41.422: E/AndroidRuntime(2584): at java.lang.reflect.Method.invoke(Method.java:525)
10-14 09:53:41.422: E/AndroidRuntime(2584): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
10-14 09:53:41.422: E/AndroidRuntime(2584): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-14 09:53:41.422: E/AndroidRuntime(2584): at dalvik.system.NativeStart.main(Native Method)
這裏是我用於重疊佈局的xml文件。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="15dip">
<ToggleButton android:id="@+id/start_button"
style="?android:attr/buttonStyleSmall"
android:layout_width="60dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:textOff="@string/button_start"
android:textOn="@string/button_reset"
android:enabled="false"
/>
<Button android:id="@+id/clear_button"
style="?android:attr/buttonStyleSmall"
android:layout_width="60dp"
android:layout_height="40dp"
android:layout_toLeftOf="@id/start_button"
android:layout_alignParentBottom="true"
android:layout_marginRight="10dip"
android:text="@string/button_clear"
/>
<Button android:id="@+id/delete_button"
style="?android:attr/buttonStyleSmall"
android:layout_width="60dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:text="@string/button_delete"
android:visibility="gone"
/>
</RelativeLayout>
同樣的錯誤親愛的沒有成功完成所有3個步驟。 :( –
@AbdulRehmanJanjua改變imageview或切換按鈕名稱,也改變了Java文件.. – Hariharan
得到它的工作後刪除其他佈局,但謝謝你我標記你的答案,因爲它給我提示如何做到這一點。 –