我想将按钮移动到中心,显示它,然后移动到角落。
但它不会动,它立即出现在角落里。为什么?
更新Android 5.1,API 22。
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// remember true position/size
final RelativeLayout.LayoutParams layoutParams_= (RelativeLayout.LayoutParams) mapFollowButton.getLayoutParams();
// create temp position/size from which will move
final RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams((int) (150*density), (int) (150*density));
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
mapFollowButton.setLayoutParams(layoutParams);
mapFollowButton.setVisibility(View.INVISIBLE);
mapFollowButton.invalidate();
final ChangeBounds transition= new ChangeBounds();
transition.setDuration(1000L);
TransitionManager.beginDelayedTransition((ViewGroup) findViewById(R.id.mainRL),transition);
//here expected to move to true position from center
mapFollowButton.setLayoutParams(layoutParams_);
mapFollowButton.setVisibility(View.VISIBLE);
} else
mapFollowButton.setVisibility(View.VISIBLE);
Run Code Online (Sandbox Code Playgroud) 如何禁止在SceneKit中旋转节点?
例如,我想要一个模型(锥形)是动态的,跳跃的和飞行的,但总是垂直定向的?
我在苹果的车辆演示中尝试修复它,这是一个糟糕的解决方案.我也尝试了下面的代码,但模型只是缓慢而且小故障掉了下来
?- (void)renderer:(id<SCNSceneRenderer>)aRenderer didSimulatePhysicsAtTime:(NSTimeInterval)time{
_node.rotation = SCNVector4Make(0, 0, 0, 0);
//[_node.physicsBody resetTransform]; // - tried this too
}
Run Code Online (Sandbox Code Playgroud)
...最后我在scenekit手册中没有找到任何"allowRotation = NO".