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 に答える