我想在android中全面了解webview,但只有设备的可见区域捕获其他区域变灰。这是代码:
$(".reset").click(function (e) {
e.preventDefault();
$(".product-group > .row").hide('slide',{direction:"left",distance:1900},200);//,function () {
var product_groups = $(".product-group");
$.ajax({
type: 'POST',
url: "?callback=?",
data: "",
success: function(data) {
product_groups.html($(data).find(".product-group").html());
PageCenterer();
isOnlyTwoProductFields();
}
});
//$(".product-group").html($("#product-field").html()).append($("#product-field").html());
count=$(".product-group > .row").size();
var index=$(".product-group > .row").index();
console.log(index);
$(".product-group > .row").each(function(index){
if ($(window).width()<600) {
$(this).find("label:first").text((index+1));
}else{
$(this).find("label:first").text((index+1)+"."+product);
}
//isOnlyTwoProductFields();
//PageCenterer();
});
//});
});
答案 0 :(得分:1)
import java.io.FileOutputStream;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Picture;
import android.os.Bundle;
import android.view.Menu;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {
WebView w ;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
w = new WebView(this);
w.setWebViewClient(new WebViewClient()
{
public void onPageFinished(WebView view, String url)
{
Picture picture = view.capturePicture();
Bitmap b = Bitmap.createBitmap( picture.getWidth(),
picture.getHeight(), Bitmap.Config.ARGB_8888);
Canvas c = new Canvas( b );
picture.draw( c );
FileOutputStream fos = null;
try {
fos = new FileOutputStream( "mnt/sdcard/yahoo.jpg" );
if ( fos != null )
{
b.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.close();
}
}
catch( Exception e )
{
}
}
});
setContentView(w);
w.loadUrl("http://search.yahoo.com/search?p=android");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
这段代码足以解释你需要的一切