CheckedTextView背景资源错误

时间:2011-07-21 09:32:42

标签: android

当我将checkedtextview的background属性设置为leftselected_xml(在eclipse中)时,错误日志显示错误,尽管程序运行正常。 xml drawable出了什么问题?是否有一些必须定义的东西?

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布局

<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)

2 个答案:

答案 0 :(得分:0)

最喜欢的     leftselected_xml drawable你没有提到你想要创建的形状。例如:Ring,rectangle ...我认为这可能是导致这个问题的原因。

答案 1 :(得分:0)

似乎这是半径android中的一个问题:Radius .. android:应该指定Radius而不是单个角...

<强>解

如果你想使用有这个问题的图形布局,请转到图形布局选项卡(我知道它不起作用)..在顶部选择Android 2.1-update1,它将正常工作。