个性化Dialog小图标,主要代码如下:
@
- Override
- protected void onCreate(Bundle savedInstanceState) {
- // Be sure to call the super class.
- super.onCreate(savedInstanceState);
- requestWindowFeature(Window.FEATURE_LEFT_ICON);
- // See assets/res/any/layout/dialog_activity.xml for this
- // view layout definition, which is being set here as
- // the content of our screen.
- setContentView(R.layout.dialog_activity);
- getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
- android.R.drawable.ic_dialog_alert);
- }
1、申请设置个性化小图标,需在 setContentView(R.layout.dialog_activity) 之前调用。
- requestWindowFeature(Window.FEATURE_LEFT_ICON);
2、设置小图标
- getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
- android.R.drawable.ic_dialog_alert);