九个补丁图片在我的设备上无法使用?

Ngu*_*inh 1 android nine-patch

这是我第一次在我的Android应用程序上使用九补丁图像.它如此愚蠢.当我在eclipse布局编辑器上预览时,它可以工作.但是,当我在真实设备(HTC Inspire 4g,HTC Explorer,...)上构建应用程序时,它不是.

<LinearLayout
                        android:layout_width="0dip"
                        android:layout_height="fill_parent"
                        android:layout_margin="5dp"
                        android:layout_weight="1"
                        android:background="@drawable/shadow_border"
                        android:gravity="center"
                        android:padding="0dip" >

                        <TextView
                            android:id="@+id/itemdetail_textview_price"
                            style="@style/textview_nomalBold"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="$10"
                            android:textColor="#F00"
                            android:textSize="32dp" />

                        <TextView
                            android:id="@+id/itemdetail_textview_originalPrice"
                            style="@style/textview_nomalBold"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="15dp"
                            android:text="$20"
                            android:textSize="32dp" />
                    </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

On Nine补丁工具

在Eclipse布局编辑器上预览

在真实设备上

这有什么问题吗?

更新:

  • 我正在为Android 2.2及更高版本编写应用程序.

  • 我的手机使用的是Android 2.3

Akr*_*ram 12

从底部和右侧移除两个点,因为这些侧面决定了您的内容应显示多少空间.

以下是九个补丁在android中的工作原理

九个补丁

在创建九个补丁图像时,请遵循本教程.