在SDK 8上看不到Android Eclipse布局

在SDK 8上看不到Android Eclipse布局,android,xml,eclipse,layout,eclipse-adt,Android,Xml,Eclipse,Layout,Eclipse Adt,我在目标SDK:17和MİN SDK:8上做了一个布局。还好。当它出现在SDK:17上时,但当用SDK:8尝试时,它在底部给出了错误。有人能告诉我如何在SDK上使用我的代码吗:8谢谢你的帮助。 这是XML <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://sc

我在目标SDK:17和MİN SDK:8上做了一个布局。还好。当它出现在SDK:17上时,但当用SDK:8尝试时,它在底部给出了错误。有人能告诉我如何在SDK上使用我的代码吗:8谢谢你的帮助。 这是XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical" >

    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:ignore="UselessParent" >

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <TextView
                android:id="@+id/textButtonBakici"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/textBakici" />

            <EditText
                android:id="@+id/editTextBakici"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_span="3"
                android:layout_weight="1"
                android:hint="@string/altiyuzyirmibes"
                android:inputType="numberDecimal" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textKrediAraba"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/textKrediAraba"/>

            <EditText
                android:id="@+id/editTextKrediAraba"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_span="3"
                android:layout_weight="1"
                android:hint="@string/besyuzdoksan"
                android:inputType="numberDecimal" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textOgrenimKredisi"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/textOgrenimKredisi" />

            <EditText
                android:id="@+id/editTextOgrenimKredisi"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_span="3"
                android:layout_weight="1"
                android:hint="@string/dortyuzon"
                android:inputType="numberDecimal" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textTatilKredisi"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/textTatilKredisi"/>

            <EditText
                android:id="@+id/editTextTatilKredisi"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_span="3"
                android:layout_weight="1"
                android:hint="@string/yuzotuzbes"
                android:inputType="numberDecimal" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow5"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <TextView
                android:id="@+id/textFaturaElektrik"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/textFaturaElektrik" />

            <EditText
                android:id="@+id/editTextFaturaElektrik"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_span="3"
                android:layout_weight="1"
                android:hint="@string/sifir"
                android:inputType="numberDecimal" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow6"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <TextView
                android:id="@+id/textFaturaSu"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/textFaturaSu" />

            <EditText
                android:id="@+id/editTextFaturaSu"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_span="3"
                android:layout_weight="1"
                android:hint="@string/sifir"
                android:inputType="numberDecimal" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow7"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <TextView
                android:id="@+id/textFaturaInternet"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/textFaturaInternet" />

            <EditText
                android:id="@+id/editTextFaturaInternet"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_span="3"
                android:layout_weight="1"
                android:hint="@string/otuz"
                android:inputType="numberDecimal" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow8"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <TextView
                android:id="@+id/textAidat"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/textAidat"/>

            <EditText
                android:id="@+id/editTextAidat"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_span="3"
                android:layout_weight="1"
                android:hint="@string/sifir"
                android:inputType="numberDecimal" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow9"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <TextView
                android:id="@+id/textKaskoSigorta"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/textKaskoSigorta" />

            <EditText
                android:id="@+id/editTextKaskoSigorta"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_span="3"
                android:layout_weight="1"
                android:ems="10"
                android:hint="@string/ikiyuzyirmibes"
                android:inputType="numberDecimal" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow10"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="10"
                android:orientation="horizontal" >

                <Spinner
                    android:id="@+id/spinnerYillar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="3"
                    android:entries="@array/Yillar"
                    android:prompt="@string/promptYillar" />

                <Spinner
                    android:id="@+id/spinnerAylar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="3"
                    android:entries="@array/Aylar"
                    android:prompt="@string/prompt" />
            </LinearLayout>

            <Button
                android:id="@+id/buttonIleri"
                style="?android:attr/buttonStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:layout_weight="0"
                android:background="@drawable/navigation_forward"
                android:gravity="right" />
        </TableRow>
    </TableLayout>

</LinearLayout>

问题不在于SDK版本或目标版本。这里的问题在于,您正在使用arraylist的某个地方,而那里的索引映射错误

log cat清楚地显示:索引为1,大小为1

这意味着您的索引超出了arraylist/array的大小

你能和我分享一下活动代码吗,或者自己检查一下尺寸问题


谢谢

问题不在于SDK版本或目标版本。这里的问题在于,您正在使用arraylist的某个地方,而那里的索引映射错误

log cat清楚地显示:索引为1,大小为1

这意味着您的索引超出了arraylist/array的大小

你能和我分享一下活动代码吗,或者自己检查一下尺寸问题


谢谢

根据我的经验和我在google io视频中听到的,你应该始终为你的应用程序使用最新的SDK,包括ui设计器

原因是谷歌只更新或主要更新了设计师的最新sdk目标,因此is的bug比以前的版本要少

另外,请注意,即使是现在,与真实设备甚至模拟器上发生的情况相比,您也无法完全信任ui设计器。很多时候,它无法很好地显示某些内容,或者根本无法显示,因为它还不受支持,例如文本阴影、部分圆角图像角等等


因此,简而言之,始终将targetSdk设置为最新版本。minSdk应该是您想要的,包括ui设计器,如果您希望在旧版本上检查它,请尝试使用模拟器或真实设备,以防出现可疑情况。

根据我的经验和我在google io视频中听到的信息,您应该始终为应用程序使用最新的SDK,包括ui设计器

原因是谷歌只更新或主要更新了设计师的最新sdk目标,因此is的bug比以前的版本要少

另外,请注意,即使是现在,与真实设备甚至模拟器上发生的情况相比,您也无法完全信任ui设计器。很多时候,它无法很好地显示某些内容,或者根本无法显示,因为它还不受支持,例如文本阴影、部分圆角图像角等等


因此,简而言之,始终将targetSdk设置为最新版本。minSdk应该是您想要的,包括ui设计器,如果您希望在旧版本上检查它,尝试使用模拟器或真实设备,以防有可疑之处。

这不是代码中的错误,而是android sdk渲染库中的一个众所周知的错误


参考:

这不是代码中的错误,而是android sdk呈现库中的一个众所周知的错误


参考资料:

错误日志真的来自Android设备吗?它看起来更像是eclipse的崩溃日志@Matthieu不,它不是来自android设备。它来自eclipse错误日志。我明白了。。。在运行SDK 8 Froyo的模拟器上运行代码时会发生什么?我自己不使用Eclipse,所以我不确定我是否可以帮助您从Android设备上读取错误日志?它看起来更像是eclipse的崩溃日志@Matthieu不,它不是来自android设备。它来自eclipse错误日志。我明白了。。。在运行SDK 8 Froyo的模拟器上运行代码时会发生什么?我自己不使用Eclipse,所以我不确定我能帮你多少忙
!ENTRY com.android.ide.eclipse.adt 4 0 2012-12-25 16:41:18.827
!MESSAGE butcegiris.xml: Index: 1, Size: 1
!STACK 0
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
    at java.util.ArrayList.rangeCheck(Unknown Source)
    at java.util.ArrayList.get(Unknown Source)
    at com.android.ninepatch.NinePatchChunk.draw(NinePatchChunk.java:174)
    at com.android.ninepatch.NinePatchChunk.draw(NinePatchChunk.java:101)
    at android.graphics.NinePatch_Delegate$1.draw(NinePatch_Delegate.java:219)
    at com.android.layoutlib.bridge.impl.GcSnapshot.drawInLayer(GcSnapshot.java:608)
    at com.android.layoutlib.bridge.impl.GcSnapshot.draw(GcSnapshot.java:577)
    at android.graphics.NinePatch_Delegate.draw(NinePatch_Delegate.java:217)
    at android.graphics.NinePatch_Delegate.nativeDraw(NinePatch_Delegate.java:170)
    at android.graphics.NinePatch.nativeDraw(NinePatch.java)
    at android.graphics.NinePatch.draw(NinePatch.java:104)
    at android.graphics.drawable.NinePatchDrawable.draw(NinePatchDrawable.java:188)
    at android.view.View.draw(View.java:6725)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
    at android.view.View.draw(View.java:6743)
    at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
    at android.view.View.draw(View.java:6743)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:466)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:320)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:440)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1545)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1302)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.changed(GraphicalEditorPart.java:718)
    at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationChooser.setConfiguration(ConfigurationChooser.java:632)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderPreviewManager.switchTo(RenderPreviewManager.java:1352)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderPreview.click(RenderPreview.java:837)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderPreviewManager.click(RenderPreviewManager.java:1494)
    at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GestureManager$Listener.mouseUp(GestureManager.java:469)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:219)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    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:344)
    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:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

!ENTRY com.android.ide.eclipse.adt 4 0 2012-12-25 16:41:18.991
!MESSAGE butcegiris.xml: Index: 1, Size: 1
!STACK 0
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1