将Android中包含webview的框架布局旋转90度
我正在尝试在android中旋转包含webview的framelayout,以下是我的代码:将Android中包含webview的框架布局旋转90度,android,view,webview,android-framelayout,rotation,Android,View,Webview,Android Framelayout,Rotation,我正在尝试在android中旋转包含webview的framelayout,以下是我的代码: FrameLayout contentView = (FrameLayout) getRootView().findViewById( R.id.content); FrameLayout backGround = new FrameLayout(getContext()); FrameLayout.LayoutParams bgfl = new FrameLayou
FrameLayout contentView = (FrameLayout) getRootView().findViewById(
R.id.content);
FrameLayout backGround = new FrameLayout(getContext());
FrameLayout.LayoutParams bgfl = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.FILL_PARENT,
FrameLayout.LayoutParams.FILL_PARENT);
backGround.addView(WebView object);
contentView.addView(backGround, bgfl);
RotateAnimation r = new RotateAnimation(0f, -90f,Animation.RELATIVE_TO_SELF,0.5f,
Animation.RELATIVE_TO_SELF,0.5f);
r.setDuration(0);
r.setFillAfter(true);
LayoutAnimationController animController = new LayoutAnimationController(r, 0);
backGround.setLayoutAnimation(animController);
旋转正常…但问题是webview中的任何可单击区域都不会根据布局的旋转坐标系更改其坐标。
此外,网络视图的滚动也正在反转
关于如何解决此问题的任何建议我也遇到过类似的问题,即在动画运行时激活部分UI,即使其中没有“任何内容”。您使用的
RotateAnimation
仅更新视图的视觉效果,所有FrameLayout
s元素在其原始位置保持不变
一种可能是为FrameLayout
创建一个单独的布局,该布局设置为类似于视图后期旋转。通过实现Animation.AnimationListener
并将实例化代码放入onAnimationEnd(Animation)
方法,可以在活动中实例化此布局
根据setDuration(int)
的值0,您可能根本不关心视图的动画效果。在这种情况下,您可以用替换布局的代码替换启动布局动画的代码。也许您需要类似触摸事件代码的代码。