2011-07-21 59 views
0

當我將checkedtextview的background屬性設置爲leftselected_xml(在eclipse中)時,雖然程序運行正常,但錯誤日誌顯示錯誤。 xml drawable有什麼問題?有沒有必要定義的東西?CheckedTextView後臺資源錯誤

leftselected_xml繪製

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <gradient 
    android:startColor="#C8C8C8" 
    android:endColor="#C8C8C8" 
    android:angle="270" /> 
     <corners android:radius="0dp" android:topLeftRadius="5dp" 
     android:bottomLeftRadius="0dp" 
     android:topRightRadius="0dp" 
     android:bottomRightRadius="5dp"/> 
</shape> 

XML佈局

<CheckedTextView 
android:checked="true" 
android:textColor="#000000" 
android:id="@+id/arrivingCTV" 
android:layout_height="wrap_content" 
android:text="@string/arriving" 
android:layout_width="wrap_content" 
android:clickable="true" 
android:background="@drawable/leftselected_xml"> 
</CheckedTextView> 

TRACE

java.lang.UnsupportedOperationException 
at android.graphics.Path_Delegate.native_addRoundRect(Path_Delegate.java:332) 
at android.graphics.Path.native_addRoundRect(Path.java) 
at android.graphics.Path.addRoundRect(Path.java:491) 
at android.graphics.drawable.GradientDrawable.draw(GradientDrawable.java:330) 
at android.view.View.draw(View.java:9014) 
at android.view.ViewGroup.drawChild(ViewGroup.java:2508) 
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2123) 
at android.view.View.draw(View.java:9032) 
at android.view.ViewGroup.drawChild(ViewGroup.java:2508) 
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2123) 
at android.view.ViewGroup.drawChild(ViewGroup.java:2506) 
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2123) 
at android.view.ViewGroup.drawChild(ViewGroup.java:2506) 
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2123) 
at android.view.View.draw(View.java:9032) 
at android.view.ViewGroup.drawChild(ViewGroup.java:2508) 
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2123) 
at android.view.View.draw(View.java:9032) 
at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:473) 
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:316) 
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:324) 
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1510) 
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1347) 
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1078) 
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:904) 
at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor.pageChange(LayoutEditor.java:403) 
at org.eclipse.ui.part.MultiPageEditorPart$2.widgetSelected(MultiPageEditorPart.java:291) 
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228) 
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) 
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) 
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027) 
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012) 
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:770) 
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3256) 
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:2045) 
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:323) 
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) 
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) 
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880) 
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473) 
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405) 
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369) 
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221) 
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500) 
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) 
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493) 
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) 
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113) 
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194) 
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) 
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) 
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368) 
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
at java.lang.reflect.Method.invoke(Unknown Source) 
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559) 
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514) 
at org.eclipse.equinox.launcher.Main.run(Main.java:1311) 

回答

0

看來,這是在半徑機器人的一個問題:半徑..安卓半徑應指定,而不是個別邊角...

SOLUTION

,如果你想使用圖形工作佈局有這個問題,去圖形佈局選項卡(它不工作我知道)..在頂部選擇Android 2.1更新1,它會正常工作。

0

贊成ite leftselected_xml drawable你沒有提到你想要創建的形狀。例如:Ring,rectangle ...我認爲這可能是造成這個問題的原因。

+0

nopes它似乎是半徑聲明應該只有android:radius!沒有單獨的條目。 –