final AlertController mAlert;
public Button getButton(int whichButton) {
return mAlert.getButton(whichButton);
}
Button btnPositive = (Button)AlertDialog.getButton(DialogInterface.BUTTON_POSITIVE); btnPositive.setTextColor(color);
protected AlertDialog(@NonNull Context context, @StyleRes int themeResId) {
super(context, resolveDialogTheme(context, themeResId));
mAlert = new AlertController(getContext(), this, getWindow());
}
#Dialog.getWindow()
public @Nullable Window getWindow() {
return mWindow;
}
//标题 TextView tvTitle = (TextView)AlertDialog.getWindow().findViewById(R.id.alertTitle); //按钮 Button btnPositive = (Button)AlertDialog.getWindow().findViewById(R.id.button1);
Field mAlert = AlertDialog.class.getDeclaredField("mAlert");
mAlert.setAccessible(true);
Object controller = mAlert.get(dialog);
Button mButtonPositive; Button mButtonNegative; Button mButtonNeutral; private TextView mTitleView; private TextView mMessageView;
Field mTitleView = controller.getClass().getDeclaredField("mTitleView");
mTitleView.setAccessible(true);
TextView tvTitle = (TextView) mTitleView.get(controller);
tvTitle.setTextColor(Color.GREEN);//更改标题的颜色
Window window = dialog.getWindow(); WindowManager.LayoutParams lp = window.getAttributes(); lp.gravity = Gravity.BOTTOM; lp.x = 100; lp.y = 100; window.setAttributes(lp);
/**
* X position for this window. With the default gravity it is ignored.
* When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
* {@link Gravity#END} it provides an offset from the given edge.
*/
@ViewDebug.ExportedProperty
public int x;
/**
* Y position for this window. With the default gravity it is ignored.
* When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
* an offset from the given edge.
*/
@ViewDebug.ExportedProperty
public int y;
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有