2

这是我的应用程序现在的样子的屏幕截图:

http://www.abload.de/image.php?img=unbenannt4kqjb.png

这是灰色形状的代码:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

<item
    android:top="0dp"
    android:bottom="0dp"
    android:left="0dp"
    android:right="0dp" >

    <shape
        android:shape="rectangle" >

        <stroke 
            android:width="8dp" 
            android:color="#9b9c9c" /> 

        <padding 
            android:left="13dp" 
            android:top="13dp" 
            android:right="13dp" 
            android:bottom="13dp" /> 

        <corners
            android:radius="10dp"
            android:topLeftRadius="0dp"
            android:bottomRightRadius="0dp" />

        <solid 
            android:color="@android:color/background_light" />

    </shape>

</item>

正如您在屏幕截图中看到的那样,右上角和左下角仍然是白色的。好的,我用红色标记了它,这样更容易识别。我想用与灰色形状相同的灰色给这件红色的东西上色,这样就只有一个“内圆角”。我希望你明白我的意思。

我通过将其设置为布局的背景来包含形状。

提前致谢。

4

1 回答 1

1

好吧,其实很简单:

我唯一要做的就是添加另一个布局,用形状的背景颜色将旧布局包围起来。

这就是布局现在的样子:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#9b9c9c"
    android:orientation="vertical" >

    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/background_shape"
        android:orientation="vertical" >
...
    </LinearLayout>
</LinearLayout>
于 2012-08-27T14:07:03.260 回答