Adapting AlertDialog to a specific design - android

I need to edit default AlertDialog theme so that it will look like part of the design of my app. I don't want to create a whole new theme for it. I will just play with its own properties and make small changes. But the problem is I can't manage to reach the source code and I don't know what kind of attributes it has.
What I need to do is basically to give background a little transparency and roundness.
Does anyone know where can I get the AlertDialog style code? And which attributes do I need to edit for transparency and roundness of background?
Thanks.

Here's the style code for AlertDialog: https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/styles.xml
I don't know how to change it the way you want though.

Related

Android, change button style at runtime

I need to change button style from "contained" to "outlined" at runtime.
For now the only way I've found to create an outlined button is to set its style to ?attr/materialButtonOutlinedStyle.
Unfortunately I haven't found a way to change the style at runtime, is it possible?
Is there any way to get this effect?
As a view with text inside, it should have "setTextAppearance" function. It's not the ideal option but may help. Also can be useful to look on https://github.com/airbnb/paris.

How do Android components look like on different themes?

I want to know how all the Android components such as dialogs, buttons,.. will look like on different themes.
Somebody got a blog or an article for this? Thank you.
Here is an example of different Android themes:
http://android.appstorm.net/how-to/customization/dress-up-your-android-with-gorgeous-themes/
As a developper, I'll say that the appearance depends on what you're using for example for a button you may re-program your own button to use in your custom theme by adding an image in the button's background, change the button's shape or color .. and of course you can also change the look at each state (pressed, focused,etc.).

Create custom button based on Android style

I need to create a custom button control that will inherit from the same Android style as all other buttons in my application. However, I want to be able to add several lines of text where some characters of the text will be in different colors. Is there anyway to achieve this, I can't seem to see a way?
Currently I have created a view that looks like a button by drawing the background, this is ok but I want the background etc to change with the application style.
You should make your button descend from the generic theme for Widget.Button. This way you can ensure that all the default settings will come through for you.

Android: Simple customization of AlertDialogs

I have read lots of articles, here and elsewhere about customizing AlertDialogs, and those created by AlertDialog.Builder.
The approach that I'm using at the moment is injecting my AlertDialog.Builder with a ContextThemeWrapper. This ContextThemeWrapper is configured to read from a custom style that inherits from Theme.Dialog.
My customization requirements are quite straightforward:
Change the title bar background colour from the default navy/black version
Change the font type and size of both title and buttons
I've had a look in the default themes.xml and styles.xml but I don't see where to configure number 1 in particular...can someone let me know how this is done?
Also, some of the solutions I've seen involve inflating a layout and then setting this using AlertDialog.Builder.setView()...if I was to customize using this way then how do I design the views for positive and negative buttons?
Thanks
Sorry, alert dialogs are not really intended to be themed like that. They are basically the most concrete thing you can do -- a canned appearance for standard common situations.
If you want to have a dialog with a customized appearance, you should just start with the Dialog class.

Is it possible to create an Android AlertDialog without a border?

I'd like to an AlertDialog that has no border. Currently all AlertDialogs on my 2 phones have borders, with the borders looking different on each phone. I'm guessing this is due to manufacturer customization.
I know I can use a standard Dialog for more control, but hope to avoid that if possible.
Take a look here: Android Borderless Dialog
A custom xml layout for the dialog should do the trick :)

Categories

Resources