0

这很安静。但不知道为什么这不起作用。

这是我在 xml 中的代码:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <Button
        android:id="@+id/one"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="center_horizontal"
        android:paddingBottom="15dp"
        android:background="@drawable/blue9Patch"
        android:paddingTop="12dp"
        android:text="One" />

    <Button
        android:id="@+id/shareProductButton_shareOptions"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="center_horizontal"
        android:paddingBottom="15dp"
        android:background="@drawable/blue9Patch"
        android:paddingTop="12dp"
        android:text="Two" />
</LinearLayout>

这是我在 Eclipse的图形布局中得到的:

在此处输入图像描述

但是在模拟器上是这样的:

在此处输入图像描述

这是我用作背景的 9 补丁图像

在此处输入图像描述

以为,在设备上它可以正常工作,但没有。

我希望它像第一张图片一样。

谢谢你。

4

1 回答 1

4

很明显,我假设您使用 .9Patch 图像设置内容区域,即在右侧和底部分配像素。您只需要清除该分配或只需填充所有底部和右端像素(填充框)。就是这样。

在此处输入图像描述

最后这个

在此处输入图像描述

于 2013-01-08T06:29:48.750 回答