这是我的嵌套布局如何将其角落更改为曲线? image url 1是我想做曲线的样本,它实现了黑色浆果 图像网址2是我的Android代码我怎么曲线布局像? url1是http://imgur.com/dFUVF 网址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>
答案 0 :(得分: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"