android webview 透明背景,在android中的半透明webview背景

编辑:我当前的解决方案。将json包装在div标签中并将其设置为透明。在android中的半透明webview背景

我从远程填充json对象的webview。

{

"message": "

The mission of the Canton Police Department is to protect the lives and properties of the citizens of Canton, enforce all city, state, and federal law",

"nationalad": ""

}

我可以让webview背景变得透明。但不是半透明的。当我尝试这个:

webView1.setBackgroundColor(Color.argb(128, 00, 00, 000));

我得到一个黑色的背景,右边有一个很小的垂直透明条。要使其透明一路:

webView1.setBackgroundColor(0x00000000);

这里是我如何把在JSON:

try{

JSONObject json = new JSONObject(result);

JSONArray nameArray = json.names();

JSONArray valArray = json.toJSONArray(nameArray);

for (int i = 0; i < valArray.length(); i++)

{

WebView webView1 = (WebView) findViewById(R.id.webView1);

// webView1.setBackgroundColor(0x00000000);

//webView1.loadDataWithBaseURL(null, valArray.getString(0), "text/html", "utf-8", null);

webView1.setBackgroundColor(Color.argb(128, 00, 00, 00));

}

编辑:XML

android:id="@+id/vsHeader"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:inflatedId="@+id/header"

android:layout="@layout/header" />

android:id="@+id/linearLayout1"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:background="@drawable/cpd"

android:gravity="center|center_horizontal|center_vertical"

android:orientation="vertical"

android:paddingBottom="50dp" >

android:id="@+id/webView1"

android:layout_width="250dp"

android:layout_height="300dp"

/>

c78bc7d5c71d9dc13d221626bba26fb5.png

2012-04-19

Rick

+0

什么是您的XML布局看起来像这个页面? –

2012-04-19 18:40:45

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值