gpt4 book ai didi

Android - WebView 的问题

转载 作者:行者123 更新时间:2023-11-29 00:47:56 24 4
gpt4 key购买 nike

我正在努力解决这个问题并多次解析网络以理解以下内容。

我正在使用嵌入 WebView 的简单 Activity:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/tables"
</LinearLayout>

如您所见,我正在尝试应用可绘制形状 (android:background="@drawable/tables"),以便 WebView 具有圆角、描边边框...... .

问题是 WebView 没有得到任何我试图设置的外观(没有圆角等...)。

我要应用的形状代码:

<?xml version="1.0" encoding="UTF-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/fond_tables"/>
<corners android:bottomRightRadius="10dp"
android:bottomLeftRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp"/>
<stroke android:width="3dp"
android:color="@color/bordure_tables" />
</shape>

如果有人能帮我解决这个问题,我将不胜感激。

提前致谢

亚当。

最佳答案

我也遇到了同样的问题。后来我知道我们不能改变 webView 的背景。您可以更改布局背景。我已经尝试过这种方法,效果很好。

<TableRow
android:id="@+id/tableRow5"

android:background="@drawable/fullshape"

android:layout_width="300dp"
android:layout_height="300dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp" >

<WebView
android:id="@+id/webView1"
android:layout_width="280dp"
android:layout_height="280dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp" />

</TableRow>

关于Android - WebView 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5246425/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com