android开发xml布局文件常见错误解决办法

main.xml:Index:0,Size:0

这个错误eclipse不会提示问题出在哪,后来发现是因为使用了9patch图片,而且被嵌套在多层级linearLayout的weight=0的布局方式中。

<!-- 包裹周围框子用置于底层内容的上层 -->

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:orientation="horizontal" >

                <!-- 第二层上侧 -->

                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_height="fill_parent"
                    android:layout_weight="1"
                    android:orientation="horizontal" >

                    <ImageButton
                        android:id="@+id/ib_"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:background="@drawable/friendscenter_head_bg" />
                    <!-- 这个地方用9patch图片会出错 -->
                </LinearLayout>

                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_height="fill_parent"
                    android:layout_weight="1"
                    android:orientation="horizontal" >

                    <ImageButton
                        android:id="@+id/ib_"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:background="@drawable/friendscenter_expandstate_bg" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_height="fill_parent"
                    android:layout_weight="1"
                    android:orientation="horizontal" >

                    <ImageButton
                        android:id="@+id/ib_"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:layout_gravity="right"
                        android:background="@drawable/friendscenter_white_bg" />
                </LinearLayout>
            </LinearLayout>


你可能感兴趣的:(android开发xml布局文件常见错误解决办法)