I need to create a activity which should look like as a dialog box with a rounded corners.
For this requirement I set
android:theme=\"@android:sty
First, create a rounded corner shape drawable like so:
dialogbg.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="15dp" />
</shape>
Then, go to the layout xml file for your activity, and change it's android:backgorund attribute like so
<RelativeLayout
android:layout_width="..."
android:layout_height="..."
android:background="@drawable/dialogbg">
<!--views here...-->
</RelativeLayout>
You could make your own theme
that has rounded corners. First you'll need a drawable
for the Activity
background:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners android:radius="15dp" />
<solid android:color="#565656" />
<stroke
android:width="3dp"
android:color="#ffffff" />
<padding
android:bottom="6dp"
android:left="6dp"
android:right="6dp"
android:top="3dp" />
</shape>
Next make your own theme that extends the parent Theme.Dialog
:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="ThemeWithCorners" parent="android:Theme.Dialog">
<item name="android:windowBackground">@drawable/another_test_drawable</item>
</style>
</resources>
This will be in a file named styles.xml
in the res/values
folder. Use this theme in the android manifest for the Activity
you want:
//...
<activity
android:name=".ActivityName"
android:label="@string/app_name"
android:theme="@style/ThemeWithCorners" >
//...