我可以旋转微调器吗?安卓工作室
Can I rotate a spinner? Androidstudio
一个简单的问题,我无法在任何地方找到答案,有没有办法旋转微调器,而不旋转屏幕或任何只创建一个旋转 90 度的微调器?
提前致谢。
在 API 级别 11+,欢迎您通过 android:rotation
in your layout XML or setRotation()
in Java 轮换任何 View
。这是否会给您带来用户喜欢的东西,我不能说。
您可以通过编程方式尝试这样的操作 -
RotateAnimation animation = new RotateAnimation(fromDegrees, toDegrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
// Adding the time needed to rotate the image
animation.setDuration(250);
// Set the animation to stop after reaching the desired position. Without this it would return to the original state.
animation.setFillAfter(true);
//Then set the animation to your view
view.startAnimation(animation);
一个简单的问题,我无法在任何地方找到答案,有没有办法旋转微调器,而不旋转屏幕或任何只创建一个旋转 90 度的微调器?
提前致谢。
在 API 级别 11+,欢迎您通过 android:rotation
in your layout XML or setRotation()
in Java 轮换任何 View
。这是否会给您带来用户喜欢的东西,我不能说。
您可以通过编程方式尝试这样的操作 -
RotateAnimation animation = new RotateAnimation(fromDegrees, toDegrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
// Adding the time needed to rotate the image
animation.setDuration(250);
// Set the animation to stop after reaching the desired position. Without this it would return to the original state.
animation.setFillAfter(true);
//Then set the animation to your view
view.startAnimation(animation);