CheckedTextView Background Resource Error
When I set the background property of the checkedtextview to leftselected_xml (in eclipse) the error log shows an error though the program runs correctly. What is wrong with the xml drawable? are there some things that must be defined?
leftselected_xml drawable
<?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 Layout
<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.editor开发者_运维百科s.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)
In favorite leftselected_xml drawable you didn't mention which shape you want to create.For example:Ring, rectangle...I thinks this can be the cause of this problem.
Seems this is a problem in the radius android:Radius.. android:Radius should be specified instead of the individual corners ...
SOLUTION
IF you want to work with the graphical layout having this problem, go to the graphical layout tab (it is not working I know) .. On top choose Android 2.1-update1 and it will work fine.
精彩评论