Android 禁用WebView的缩放
我有一个问题,我有以下布局:Android 禁用WebView的缩放,android,android-animation,Android,Android Animation,我有一个问题,我有以下布局: <RelativeLayout android:id="@+id/Parent" android:layout_width="match_parent" android:layout_height="match_parent"> <OTHERVIEWS..../> <WebView android:id="@+id/WebView" android:layout
<RelativeLayout
android:id="@+id/Parent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<OTHERVIEWS..../>
<WebView
android:id="@+id/WebView"
android:layout_width="match_parent"
android:layout_height="match_parent"></WebView>
</RelativeLayout>
然后重写WebView中的某个方法,使其忽略其父级缩放-或者其他方式?有什么想法吗
我知道最简单的解决方案就是在每个特定的子对象上进行扩展,但由于我在很多地方都需要此功能,因此在webview中进行此操作将是最好的解决方案。您正在访问类似的父id
findViewById(R.id.Parent).animate().scaleX(0.75f).scaleY(0.75f).setDuration(750).start();
所有其他视图(包括WebView)都在其中。设置父视图的动画时,所有子视图也将设置动画。。只需创建另一个布局(您想要设置动画,或者我指的是您想要设置动画的区域)
//只有那些视图将为AnimatingLayout(RelativeLayout)的子视图设置动画
如果还有其他问题,请询问我。您想在视觉上实现什么?您的WebView是在RelativeLayout中声明的,但是您没有将其相对于其中的任何其他视图进行布局。我已经简化了很多-整个应用程序都是围绕着它构建的,您可以单击按钮来缩放整个窗口(为窗口周围的额外文本留出空间)。但是Webview存在一个问题,即它在缩放其父对象时会丢失一些内容(4.2.2中的错误)。您需要发布一些您正在谈论的内容的图片,以便我们可以帮助您。
findViewById(R.id.Parent).animate().scaleX(0.75f).scaleY(0.75f).setDuration(750).start();
<RelativeLayout
android:id="@+id/Parent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/AnimatingLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<OTHERVIEWS..../>
</RelativeLayout>// it is the end of AnimatingLayout
<WebView
android:id="@+id/WebView"
android:layout_width="match_parent"
android:layout_height="match_parent"></WebView>
</RelativeLayout>
findViewById(R.id.AnimatingLayout).animate().scaleX(0.75f).scaleY(0.75f).setDuration(750).start();