2

这是我的嵌套布局如何将其角更改为曲线?图像 url 1 是我想做曲线的示例,它实现了 inblack berry 图像 url 2 是我的 android 代码我如何像这样的曲线布局?url1 是http://imgur.com/dFUVF url 2 是 http://imgur.com/UMffI

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="500dp"

    android:background="#D3D3D3"
    android:orientation="vertical"
    android:paddingLeft="3dip"
    android:paddingRight="3dip"
    >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="120dp"

        android:background="#333333"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/btnMiniStatement"
            style="@style/HomeButton"
            android:layout_width="wrap_content"
            android:drawableTop="@drawable/home_button1"
            android:onClick="onClickFeature"
            android:text="MINI STATEMENT" />

        <Button
            android:id="@+id/btnBalanceInquiry"
            style="@style/HomeButton"
            android:layout_width="wrap_content"
            android:drawableTop="@drawable/home_button2"
            android:onClick="onClickFeature"
            android:text="Balance Inquiry" />

        <Button
            android:id="@+id/btnUtilityBalanceInquiry"
            style="@style/HomeButton"
            android:layout_width="wrap_content"
            android:drawableTop="@drawable/home_button3"
            android:onClick="onClickFeature"
            android:text="Utility Balance Inquiry" />
    </LinearLayout>
4

1 回答 1

7

res/drawable创建一个新文件(例如curved_bg.xml)。在那个文件里放:

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

    <solid android:color="#333333" />

    <corners android:radius="5dp" />

    <stroke
        android:width="1dp"
        android:color="#ffffff" />

</shape>

在您的布局文件中将其设置为您内部的背景LinearLayout

android:background="@drawable/curved_bg"
于 2012-09-24T13:30:16.507 回答