Android 将背景图像应用于AlertDilog
我想以不同的样式显示一个菜单,我想给Android 将背景图像应用于AlertDilog,android,background,android-alertdialog,Android,Background,Android Alertdialog,我想以不同的样式显示一个菜单,我想给alertdialog提供背景图像 帮助我实现目标的任何教程或链接。好的,你可以在自定义视图中创建一个AlertDialog,在该自定义视图中只指定你想要的背景。稍后设置该视图,如AlertDialog自定义视图。 例如: -相对稳定的布局: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/
alertdialog
提供背景图像
帮助我实现目标的任何教程或链接。好的,你可以在自定义视图中创建一个AlertDialog,在该自定义视图中只指定你想要的背景。稍后设置该视图,如AlertDialog自定义视图。 例如: -相对稳定的布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/shape_1"
android:padding="10dip">
............
</RelativeLayout>
希望这有帮助是的……谢谢你的回复,但我已经完成了……效果很好……再次感谢
protected void createCustomDialog(int drawable, String title, String message){
LayoutInflater inflater = LayoutInflater.from(WkActivity.this);
View customDialog = inflater.inflate(R.layout.generic_error_dialog, null);
((TextView)customDialog.findViewById(R.id.genericErrorDialogTitle)).setText(title);
((TextView)customDialog.findViewById(R.id.genericErrorDialogMessage)).setText(message);
((ImageView)customDialog.findViewById(R.id.genericErrorDialogIcon)).setImageResource(drawable);
dialog = new AlertDialog.Builder(WkActivity.this).create();
dialog.setView(customDialog);
dialog.setButton(getText(R.string.listaBusquedasGuardadasNoResultDialogButton), onClickListener);
dialog.show();
}