开发者

Android Dialog Look and Feel

After applying the latest update to my Samsung GalaxyTab 10.1, I got a "new" look for the dialogs I created in code. I assumed this was a Samsung skin, and not much I could do about it (honestly, I actually felt like I shouldn't override the default looks, anyway).

The update is:

  • Android Version 3.1
  • Kernel Version 2.6.36.3 se.infra@SEP-63 #1
  • Build Number HMJ37.UEKME P7510UEKME

However, I noticed that the Android Market App开发者_如何学Python still has the previous style dialog (these have blue lines at the top, and thin separators between the buttons).

Leads me to two questions:

  1. Programatically, is there an option to avoid any skin or changes that were added/incorporated? Eg, default to the original? Or, do I need to set up my own style for that?

  2. UI/UX, do you believe we should use the skin or not? While I realize this is opinion, as expierenced Android developers, this seems like one of the many fragmentation issues we have to deal with, and I'm curious of the expectations of others.

I am creating the Dialog in onCreateDialog of a DialogFragment

return new AlertDialog.Builder(getActivity())
            .setTitle(getString(R.string.AddMetTitle))
            .setView(v)
            .setPositiveButton(android.R.string.ok,
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                            //do some stuff - removed
                        }
                    }
            )
            .setNegativeButton(android.R.string.cancel,
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                            //dismiss 
                        }
                    }
            )
            .create();


you can pull the default Dialog resources out of the layout and drawables folders inside your SDK platforms/{OS version} folder. If you include these resources in your application and make your dialogs use them the dialogs will end up looking the same on every device. Unless you supply your own(even if "your own" are just copies of the default) resources I don't think you have any control over what it will end up looking like because of the different skins on different devices..

Edit: Here are some of the resources I am not sure if these are all the ones you'll need to get it fully inflated though.

http://dl.dropbox.com/u/5724095/Android%20Apps/dialog_res.zip


if i were you i'd just set the dialog's layout to something custom with setcontentview()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜