2
我想在我的應用程序中開啓/關閉開關Mentioned here。不過,雖然如下 <Switch android:textOn="ON" android:textOff="OFF" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
錯誤在Android中使用ON/OFF開關時發生錯誤
我得到的錯誤給出的開關設計我的佈局越來越錯誤
`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文件。在API級別加入
<?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>
的minSdkVersion =「14」你能不能請附上您的xml文件的代碼? – Swayam 2012-07-12 11:13:57
它只有一個組件是開關 – Kamalone 2012-07-12 11:17:14
@Paru:在爲應用程序設置'@android:style/Theme.Holo'主題後嘗試,也看到這個問題http://code.google.com/p/android/issues/在佈局中添加了詳細信息?id = 21017 – 2012-07-12 11:24:12