How to use vendor theme in Android application
I'm developing my "Hello, World" application for Android and came around something that annoys me.
The theme used for my app's AlertDialog
isn't the same used for other such dialogs presented on the device. The device is a HTC Desire HD on which I've changed the theme, but I was expecting that standard UI ele开发者_如何学Cments (like AlertDialog
) would somehow reflect the device theme. It's something that I'm missing or maybe a know problem with some vendors/models?
Here's my code:
final AlertDialog.Builder confirm = new AlertDialog.Builder(this);
confirm.setTitle("Delete")
.setMessage("Really Delete?")
.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// ...
}
})
.setNegativeButton("Cancel", null)
.show();
And here's how the dialog looks like in different situations:
Device's AlertDialog
with default theme (Messages app)
Device's AlertDialog
with changed theme (Messages app)
My app's AlertDialog
(with both default and changed theme)
Thanks.
Your assumption is correct. HTC have most likley created customized dialogs for the HTC apps.
精彩评论