我想在scrollview中添加一个webview,它可以显示具有透明背景的静态
HTML文本.这是代码
WebView descr = (WebView) view.findViewById(R.id.description);
descr.setBackgroundColor(Color.TRANSPARENT);
descr.loadData(desc, "text/html", "utf-8");
descr.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
如果我没有设置setLayerType值,我可以正确看到文本.但是,当滚动完成时,它会增加闪烁效果.如果添加了setLayerType行,则某些页面的文本将消失.这是我的布局的样子
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/title" >
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:descendantFocusability="blocksDescendants">
android:id="@+id/icon"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:contentDescription="@id/title"
android:paddingLeft="10dp"
android:paddingRight="10dp"
/>
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:textAlignment="gravity"
android:textSize="14sp"
android:background="@null"
android:focusable="false" />
当我在我的手机上安装.apk文件而不是在模拟器上时,会出现此问题.我使用的是Android 4.1.2版.有人能告诉我需要做什么,以便显示文本而不会产生闪烁效果和透明背景吗?