我创建了一个CustomView扩展View.创建一些CustomView并使用动画来移动和旋转它们.更改backgroundResource和错误发生后,新的背景不会填写所有CustomView.请看代码:
clearAnimation();
AnimationSet animation = new AnimationSet(true);
TranslateAnimation translateAnimation = new TranslateAnimation(0, destX - srcX, 0, destY - srcY);
translateAnimation.setInterpolator(new LinearInterpolator());
translateAnimation.setDuration((long) MGConstant.ANIMATE_DURATION);
animation.addAnimation(translateAnimation);
final float finalX = destX;
final float finalY = destY;
animation.setAnimationListener(new AnimationListener() {
public void onAnimationEnd(Animation arg0) {
clearAnimation();
setX(finalX);
setY(finalY);
RotateAnimation rotateAnimation = new RotateAnimation(0, degrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setDuration((long) MGConstant.ANIMATE_DURATION);
rotateAnimation.setFillAfter(true);
startAnimation(rotateAnimation);
resetLayout();
mMoveStatus = false;
degree = degrees;
}
public …Run Code Online (Sandbox Code Playgroud) 我有一个可观察的Knockout模型阵列.我希望能够显示所选项的详细信息,并保留文本框等绑定到该Knockout项目的模型,可能吗?
我想知道是否有人可以帮忙。我们正在将 Spring Webflow 2 应用程序从使用基于 jsp 的视图层转换为基于 Thymeleaf 的视图。
对于这大部分来说,这是可以的,但现在我正在努力让 Thymeleaf 访问我们放入servletContext.
因此,我们有一个对象被放入servletContextbean 的一部分(实现ServletContextAware和InitializingBean)
为了简单起见,我们假设它是一个字符串:
public class ReferenceDataBuilder implements ServletContextAware, InitializingBean {
public void setServletContext(ServletContext p_context) {
p_context.setAttribute("referenceData", "test text" );
}
Run Code Online (Sandbox Code Playgroud)
在基于 jsp 的视图中,我们可以referenceData像这样访问对象:
<p><c:out value="${referenceData}"/></p>
Run Code Online (Sandbox Code Playgroud)
借助 Spring EL 的魔力,它知道它可以访问的各种范围(servletContext、等),并且(我猜? flowScope)flashScope搜索每个范围,直到找到匹配的属性。结果是:
<p>test text</p>
Run Code Online (Sandbox Code Playgroud)
在视图中呈现。
在我们的 thymeleaf 模板中,我们尝试做同样的事情:
<p th:text="${referenceData}"/></p>
Run Code Online (Sandbox Code Playgroud)
但这只是返回一个空字符串。该视图呈现一个空字符串:
<p></p>
Run Code Online (Sandbox Code Playgroud)
(但我认为 EL 实际上是作为 null 返回的)
我非常确定,如果该referenceData对象是诸如flowScope或 之类的范围的属性flashScope,那么这将起作用 …