EDIT :Мое текущее решение. Был заключен json в тег div и также установлен прозрачный.
Я удаленно заполняю веб-просмотр из объекта json.
{
"message": "<p style=\"color:#EEEEEE;background-color:transparent;font-family:'Arial Narrow','Nimbus Sans L',sans-serif;\"><\/p><p style=\"color:#EEEEEE;background-color:transparent;font-family:'Arial Narrow','Nimbus Sans L',sans-serif;\">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<\/p>",
"nationalad": ""
}
Я могу сделать фон веб-просмотра прозрачным. Но не полупрозрачный. Когда я пробую это :
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
<!-- Included header.xml here -->
<ViewStub
android:id="@+id/vsHeader"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inflatedId="@+id/header"
android:layout="@layout/header" />
<LinearLayout
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" >
<WebView
android:id="@+id/webView1"
android:layout_width="250dp"
android:layout_height="300dp"
/>
</LinearLayout>
</LinearLayout>