小编Pav*_*l P的帖子

字段之间关系的Grails域类约束

我需要在Grails中编写Domain类约束,它表示一个整数字段必须大于或等于另一个整数字段.

当我写这样的代码时:

class MyDomain {

 String title
 int valueMin = 1
 int valueMax = 1

 static constraints = {
  valueMin(min:1)
  valueMax(min:valueMin)
 }
}
Run Code Online (Sandbox Code Playgroud)

我收到错误:

Caused by: groovy.lang.MissingPropertyException: No such property: valueMin for class: MyDomain
Run Code Online (Sandbox Code Playgroud)

好吗,拜托?

grails constraints grails-validation

5
推荐指数
1
解决办法
4875
查看次数

如何在Android中的ProgressDialog中为不确定的ProgressBar设置主题

我有一个Android(在A2.2上开发)应用程序,定义了以下主题:

<style name="ProgressBar"> parent="@android:style/Widget.ProgressBar">
    <item name="android:indeterminateDrawable">@drawable/progress_medium</item>
</style>
<style name="AlertDialog" parent="@android:style/AlertDialog">
    <item name="android:fullDark">@drawable/bgr_alert</item>
</style>
<style name="MyTheme" parent="@android:style/Theme.Light.NoTitleBar">
    <item name="android:alertDialogStyle">@style/AlertDialog</item>
    <item name="android:progressBarStyle">@style/ProgressBar</item>
</style>
Run Code Online (Sandbox Code Playgroud)

'progress_medium'drawable是我的自定义(蓝色)进度条,'bgr_alert'是自定义(白色)背景.

当我显示对话框时(应用程序的主题是'MyTheme')

@Override
protected Dialog onCreateDialog(int id) {
  progressDialog = new ProgressDialog(this);
  progressDialog.setCancelable(false);
  progressDialog.setIndeterminate(true);
  return progressDialog;
}
Run Code Online (Sandbox Code Playgroud)

显示的对话框包含自定义背景(白色),但不确定的progressBar不可见.

另一方面,如果我手动设置可绘制的进度:

progressDialog.setIndeterminateDrawable(getResources().getDrawable(R.drawable.progress_medium));
Run Code Online (Sandbox Code Playgroud)

一切都很完美 - 自定义背景和自定义进度可绘制.

任何提示,为什么progressBar drawable不是由主题主题隐式设置的?

android themes progressdialog customdialog progress-bar

4
推荐指数
1
解决办法
2万
查看次数