2013-02-22 98 views
0

我已經決定根據屏幕和密度的大小分開我的佈局。 在 正常LDPI的文件不工作 小LDPI要麼 在其他文件夾中的其他文件都是精品。錯誤佈局正常LDPI

這裏是我在我的文件中的錯誤:

Exception raised during rendering: Index: 1, Size: 1 
Exception details are logged in Window > Show View > Error Log 

在錯誤日誌,我有:

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) 

我用API等級8,它應該工作應該沒有吧?

下面是對應於錯誤的XML文件,上面

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/layout1" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:weightSum="10" 
    android:orientation="vertical" 
    android:background="@drawable/fond"> 

    <ImageView 
     android:id="@+id/imageView9" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="2" 
     android:scaleType="fitXY" 
     android:src="@drawable/bandeau" /> 

    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/layout2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:layout_weight="6" 
     android:background="@drawable/fondshare" 
     android:gravity="center" 
     android:orientation="vertical" 
     android:weightSum="3" > 

     <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:weightSum="2" 
      android:layout_gravity="center" 
      android:layout_marginTop="10dp" 
      android:orientation="horizontal" > 

      <ImageView 
       android:id="@+id/imageView5" 
       android:layout_width="fill_parent" 
       android:layout_height="match_parent" 
       android:adjustViewBounds="true" 
       android:src="@drawable/cadre" /> 

      <ImageView 
       android:id="@+id/imageView8" 
       android:layout_width="fill_parent" 
       android:layout_height="match_parent" 
       android:adjustViewBounds="true" 
       android:src="@drawable/niceshot" /> 

     </LinearLayout> 

     <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="2" 
      android:weightSum="5" 
      android:layout_gravity="center" 
      android:layout_marginLeft="20dp" 
      android:layout_marginRight="20dp" 
      android:layout_marginBottom="10dp" 
      android:orientation="vertical"> 

      <ImageView 
       android:id="@+id/imageView7" 
       android:layout_weight="1" 
       android:layout_width="wrap_content" 
       android:layout_height="fill_parent" 
       android:adjustViewBounds="true" 
       android:src="@drawable/enterthename" /> 

      <EditText 
       android:id="@+id/editText1" 
       android:layout_weight="1" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:layout_marginTop="4dp" /> 

      <ImageView 
       android:id="@+id/imageView2" 
       android:layout_weight="1"    
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:layout_marginTop="4dp" 
       android:adjustViewBounds="true" 
       android:src="@drawable/sharefacebook" /> 

      <ImageView 
       android:id="@+id/imageView3" 
       android:layout_weight="1"    
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:layout_marginTop="4dp" 
       android:adjustViewBounds="true" 
       android:src="@drawable/sharetwitter" /> 

      <ImageView 
       android:id="@+id/imageView6" 
       android:layout_weight="1"    
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:layout_marginTop="4dp" 
       android:adjustViewBounds="true" 
       android:src="@drawable/sharefacebook" /> 

     </LinearLayout> 
    </LinearLayout> 

    <ImageView 
     android:id="@+id/imageView10" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="2" 
     android:scaleType="fitEnd" 
     android:src="@drawable/dim" /> 

</LinearLayout> 
+0

郵java代碼...... – Pragnani 2013-02-22 18:47:42

回答

2

我有同樣的問題,我通過更新我的SDK管理器解決了這個問題iepreviously我不得不SDK 4.0.3高達(API 15)安裝在我的月食...我安裝了最新版本4.1.2(API 16)和錯誤消失了。實際上,它是API 16版本解決的以前庫中的一個錯誤。