我不知道这个布局有什么问题:
<ImageView
android:id="@+id/seticonimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:contentDescription="@string/description"
android:scaleType="fitStart"
android:src="@drawable/cm7_icon" />
<EditText
android:id="@+id/vsname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/seticonimage"
android:hint="@string/entername"
android:inputType="text" />
<EditText
android:id="@+id/vsdesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/vsname"
android:layout_toLeftOf="@+id/seticonimage"
android:hint="@string/shrtdesc"
android:inputType="text" />
<Spinner
android:id="@+id/spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/vsdesc"
android:layout_toLeftOf="@+id/seticonimage"
android:prompt="@string/icon_prompt" />
<TextView
android:id="@+id/spinnerinfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/spinner"
android:layout_below="@+id/spinner"
android:layout_toLeftOf="@+id/seticonimage" />
但它以这个错误关闭:
04-06 06:01:18.203: E/AndroidRuntime(1979): java.lang.ClassCastException: android.widget.Spinner cannot be cast to android.widget.EditText
04-06 06:01:18.203: E/AndroidRuntime(1979): at com.manager.boot.free.MultiBootManager.onContextItemSelected(MultiBootManager.java:144)
04-06 06:01:18.203: E/AndroidRuntime(1979): at android.app.Activity.onMenuItemSelected(Activity.java:2509)
04-06 06:01:18.203: E/AndroidRuntime(1979): at com.android.internal.policy.impl.PhoneWindow$DialogMenuCallback.onMenuItemSelected(PhoneWindow.java:3521)
04-06 06:01:18.203: E/AndroidRuntime(1979): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
04-06 06:01:18.203: E/AndroidRuntime(1979): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
04-06 06:01:18.203: E/AndroidRuntime(1979): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
04-06 06:01:18.203: E/AndroidRuntime(1979): at com.android.internal.view.menu.MenuDialogHelper.onClick(MenuDialogHelper.java:167)
04-06 06:01:18.203: E/AndroidRuntime(1979): at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:924)
04-06 06:01:18.203: E/AndroidRuntime(1979): at android.widget.AdapterView.performItemClick(AdapterView.java:292)
04-06 06:01:18.203: E/AndroidRuntime(1979): at android.widget.AbsListView.performItemClick(AbsListView.java:1058)
04-06 06:01:18.203: E/AndroidRuntime(1979): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2514)
04-06 06:01:18.203: E/AndroidRuntime(1979): at android.widget.AbsListView$1.run(AbsListView.java:3168)
04-06 06:01:18.203: E/AndroidRuntime(1979): at android.os.Handler.handleCallback(Handler.java:605)
04-06 06:01:18.203: E/AndroidRuntime(1979): at android.os.Handler.dispatchMessage(Handler.java:92)
04-06 06:01:18.203: E/AndroidRuntime(1979): at android.os.Looper.loop(Looper.java:137)
04-06 06:01:18.203: E/AndroidRuntime(1979): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-06 06:01:18.203: E/AndroidRuntime(1979): at java.lang.reflect.Method.invokeNative(Native Method)
04-06 06:01:18.203: E/AndroidRuntime(1979): at java.lang.reflect.Method.invoke(Method.java:511)
04-06 06:01:18.203: E/AndroidRuntime(1979): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-06 06:01:18.203: E/AndroidRuntime(1979): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-06 06:01:18.203: E/AndroidRuntime(1979): at dalvik.system.NativeStart.main(Native Method)
我在这里做错了什么?
final View textEntryView = factory.inflate(R.layout.editvslayout,
null);
final EditText evsname = (EditText) textEntryView
.findViewById(R.id.vsname);
final EditText evsdesc = (EditText) textEntryView
.findViewById(R.id.vsdesc);
final Spinner spinner = (Spinner) textEntryView
.findViewById(R.id.spinner);
final ImageView i = (ImageView) textEntryView
.findViewById(R.id.seticonimage);