alertdialog - How To Make Custom Alert Dialog on Android? -


i want make custom alert dialog different style. know, default style square. want make on candy crush game if ever seen. i've try change background style, default background still appear. xml file dialog layout.

<?xml version="1.0" encoding="utf-8"?>  <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="vertical" android:background="@drawable/dialog" >  <imageview      android:id="@+id/ivpic"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_centerhorizontal="true"/> <scrollview      android:id="@+id/svalert"     android:layout_width="wrap_content"     android:layout_below="@+id/ivpic"     android:layout_height="200px"     >     <textview          android:id="@+id/tvmessage"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="text"/> </scrollview> <button      android:id="@+id/boke"     android:gravity="center"     android:layout_width="wrap_content"     android:layout_below="@+id/svalert"     android:layout_height="wrap_content"     android:text="ok"/> </relativelayout> 

could me please? before...

first, set custom theme background image:

<?xml version="1.0" encoding="utf-8"?> <resources>     <style name="mydialogtheme" parent="android:theme.dialog">         <item name="android:windowbackground">@drawable/dialog</item>     </style> </resources> 

then,set theme dialog:

alertdialog.builder builder = new alertdialog.builder(new contextthemewrapper(this, r.style.mydialogtheme)); 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -