試試這個
在佈局
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#FFF">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dip"
android:background="@drawable/background"
android:orientation="vertical" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@xml/shape_round_rect"
android:orientation="vertical" />
</FrameLayout>
在XML &的形狀
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners android:radius="15dip" />
<stroke
android:width="5dip"
android:color="#FFF" />
</shape>
你想圓位圖的角落? – 2013-02-14 13:45:28
但我設置圖像的線性佈局背景,所以我怎麼可以讓linearlayout背景圖像形狀 – 2013-02-14 13:46:26
最簡單的方法是編輯位圖給它圓角。如果這不是一種選擇,請查看Romain Guy關於圍繞圖像角落的文章:http://www.curious-creature.org/2012/12/11/android-recipe-1-image-with-rounded-corners/ – 2013-02-14 13:49:34