编辑:我当前的解决方案。将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"
/>
2012-04-19
Rick
+0
什么是您的XML布局看起来像这个页面? –
2012-04-19 18:40:45