我想要在我的应用程序中提到的开/关开关。但是我的布局在设计开关时出现错误,如下所示
<Switch
android:textOn="ON"
android:textOff="OFF"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
我得到的错误是
`ENTRY com.android.ide.eclipse.adt 4 0 2012-07-12 16:33:07.619
!MESSAGE main.xml: Failed to find style 'switchStyle' in current theme
!ENTRY com.android.ide.eclipse.adt 4 0 2012-07-12 16:33:07.620
!MESSAGE main.xml: Failed to find style 'switchStyle' in current theme
!ENTRY com.android.ide.eclipse.adt 4 0 2012-07-12 16:33:07.620
!MESSAGE main.xml: Failed to find style 'switchStyle' in current theme
!ENTRY com.android.ide.eclipse.adt 4 0 2012-07-12 16:33:07.621
!MESSAGE main.xml: Failed to find style 'switchStyle' in current theme
!ENTRY com.android.ide.eclipse.adt 4 0 2012-07-12 16:33:07.622
!MESSAGE main.xml: Failed to find style 'switchStyle' in current theme
!ENTRY com.android.ide.eclipse.adt 4 0 2012-07-12 16:33:07.622
!MESSAGE main.xml: Failed to find style 'switchStyle' in current theme
!ENTRY com.android.ide.eclipse.adt 2 0 2012-07-12 16:33:07.637
!MESSAGE main.xml: You must supply a layout_width attribute.
!ENTRY com.android.ide.eclipse.adt 2 0 2012-07-12 16:33:07.638
!MESSAGE main.xml: You must supply a layout_height attribute.
我的 xml 文件。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Switch
android:textOn="ON"
android:textOff="OFF"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>