As far as they know, WebView is the same as the built-in browser? Right?
I ran into a problem when a page containing some absolute positioned div elements flows on top of each, instead of finding their correct location, and the background-image is completely ignored.
This means that in the browser on my phone (HTC Incredible S - 2.3.3, the browser of the browser) it correctly displays it, and, in addition, applications that use the built-in web view, which I can point to the page, correctly display . This makes me believe that the webview that I have in my application is somehow bjorking.
import android.app.Activity; import android.content.Intent; import android.graphics.Rect; import android.graphics.drawable.AnimationDrawable; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.webkit.WebSettings.LayoutAlgorithm; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.Toast; import java.util.*; public class ShowWebView extends Activity { public WebView web; public String baseURL = "http://test.dev/"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.webpage); web = (WebView) findViewById(R.id.webpage); home = (Button) findViewById(R.id.tool_Home); back = (ImageButton) findViewById(R.id.tool_Back); forward = (ImageButton) findViewById(R.id.tool_Forward); refresh = (ImageButton) findViewById(R.id.tool_Refresh); ajax = (ImageView) findViewById(R.id.test_anim); ajax.setBackgroundResource(R.drawable.ajax_animation);
also heres my webview xml
<?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" style="@style/MainPage" android:orientation="vertical" > <LinearLayout android:id="@+id/Header" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <ImageView android:id="@+id/ImageView01" android:layout_width="match_parent" android:layout_height="42sp" android:scaleType="fitXY" android:src="@drawable/top_header" /> </LinearLayout> <LinearLayout android:id="@+id/SubHeader" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <ImageView android:id="@+id/imageView1" android:layout_width="match_parent" android:layout_height="28sp" android:scaleType="fitXY" android:src="@drawable/top_sub_header" /> </LinearLayout> <LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:id="@+id/linearLayout2" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:orientation="vertical" > <WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webpage" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout> <LinearLayout android:id="@+id/toolBar" android:layout_width="match_parent" android:layout_height="40sp" android:layout_marginTop="2.5sp" android:orientation="horizontal" > <Button android:id="@+id/tool_Home" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Home" /> <ImageButton android:id="@+id/tool_Back" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/backward" /> <ImageButton android:id="@+id/tool_Forward" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/forward" /> <ImageButton android:id="@+id/tool_Refresh" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/refresh" /> <ImageView android:id="@+id/test_anim" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:layout_centerHorizontal="true" /> </LinearLayout> </LinearLayout> </LinearLayout>
any help resolving this problem will be truly amazing!
source share