As a result, I used WebView :
public class TestwebViewimageActivity extends Activity { private WebView wv; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); wv = (WebView) findViewById(R.id.webview); wv.setWebViewClient(new HelloWebViewClient()); wv.setBackgroundColor(0x00000000); wv.getSettings().setBuiltInZoomControls(false); wv.setVerticalScrollBarEnabled(false); wv.setHorizontalScrollBarEnabled(false); wv.loadUrl("file:///android_asset/6.html"); } private class HelloWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } }
main.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" android:orientation="vertical"> <WebView android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="fill_parent"/> </LinearLayout>
6.html
<html> <head> <style type="text/css"> body { margin: 0; background-color: black; } html, body, #my-image { width: 100%; height: 100%; } #my-image { background-size: cover; background-image: url(splash.png); background-position: center center; background-repeat: no-repeat; } </style> </head> <body> <div id="my-image"></div> </body> </html>
source share