1

I am bumping this thread: Android: Simple customization of AlertDialogs

I have the exactly same question. Sadly there is no satisfying answer to be found in this thread. However a few years have passed, probably there is now a more effective way, to solve this problem.

I hope someone can help.

Community
  • 1
  • 1
quiK
  • 11
  • 2
  • [Have you checked the API Guide for Dialogs?](http://developer.android.com/guide/topics/ui/dialogs.html) – Andrew Schuster Jun 16 '14 at 15:39
  • possible duplicate of [Android: Simple customization of AlertDialogs](http://stackoverflow.com/questions/9252963/android-simple-customization-of-alertdialogs) – TheMP Jun 16 '14 at 15:48
  • The answer to this other question might help: http://stackoverflow.com/a/9827390/475217 – Ben Jakuben Jun 16 '14 at 16:25

3 Answers3

0

If you want to customize your dialog read about Dialog Fragments and create your own fully customized layout for dialogs
Documentation ref

user3455363
  • 408
  • 1
  • 5
  • 13
0

Take a look of this answer in this question

From question:

AlertDialog.Builder builder = new AlertDialog.Builder(context)
        .setTitle("My title")
        .setMessage("Enter password");
final FrameLayout frameView = new FrameLayout(context);
builder.setView(frameView);

final AlertDialog alertDialog = builder.create();
LayoutInflater inflater = alertDialog.getLayoutInflater();
View dialoglayout = inflater.inflate(R.layout.simple_password, frameView);
alertDialog.show();

Custom dialog view:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent">

<EditText
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/password_edit_view"
    android:inputType="textPassword"/>
<CheckBox
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/show_password"
    android:id="@+id/show_password_checkbox"
    android:layout_gravity="left|center_vertical"
    android:checked="false"/>

</LinearLayout>
Community
  • 1
  • 1
BlaShadow
  • 11,075
  • 7
  • 39
  • 60
  • Sorry for the late reply. Actually i am searching a way to solve the problem via themes.xml and styles.xml, not with a custom dialog view – quiK Jun 24 '14 at 08:32
0

I had this same issue when I was creating my app! I needed a custom built dialog to suit my needs. The answer was really quite simple! I just created a regular XML file that I wanted to be my dialog, then in java registered a new Dialog, Dialog diagog=new Dialog(R.id.customdialog), and then when I wanted it to appear simply said, diagog.show()! I hope this helps you because it worked awesome for me.

endlesschaos
  • 145
  • 1
  • 6