I have defined a simple ring suitable for use as a button background. Here is how I do it:
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:innerRadius="20dp" android:thickness="1dp" android:useLevel ="false" > <solid android:color="@color/lines" /> /> </shape>
I use it in relative layout, for example:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent" android:padding="30dip" android:orientation="vertical"> <TextView android:text="@string/start_game" android:layout_height="wrap_content" android:layout_width="wrap_content" /> <Button android:id="@+id/start" android:layout_height="wrap_content" android:layout_width="wrap_content" android:background="@layout/round_button" android:layout_alignParentBottom="true" /> </RelativeLayout>
Where round_button is my xml file where I defined the ring. This gives me great results when I set the minimum sdk level to 11 or higher. But the problem is that when I try to change it to a level below the api, say 3, the ring does not appear! What am I missing here?
Jazib source share