Lập trình Android: Xem ảnh với WebView pot

2 224 0
Lập trình Android: Xem ảnh với WebView pot

Đang tải... (xem toàn văn)

Thông tin tài liệu

Trung tâm Tin học – ĐH KHTN Mẹo nhỏ thể hiện hình ảnh File main: <?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/webView1" android:layout_weight="1" android:layout_width="match_parent" android:layout_height="match_parent" /> <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/englan11d" /> </LinearLayout> File Activity: package com.dac; import android.app.Activity; import android.os.Bundle; import android.webkit.WebView; public class TestNg21Th11Activity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); WebView w = (WebView)findViewById(R.id.webView1); w.getSettings().setBuiltInZoomControls(true); w.loadUrl("file:///android_asset/england.jpg"); } } Lập trình Android – http://laptrinhdidong.vn Page 1 Trung tâm Tin học – ĐH KHTN Nhìn ứng dụng có vẻ đơn giản là hiển thị cùng 1 tấm hình nhưng dùng 2 công cụ khác nhau. Các bạn có thể dùng các file hiệu chỉnh lại ảnh trước khi đưa lên ứng dụng, nhưng không thể phóng to và thu nhỏ dễ dàng như dùng WebView Mọi ý kiến đóng góp các bạn vui lòng gữi bài viết về www.forum.laptrinhdidong.vn . Rất mong nhận được sự phản hồi của các bạn Lập trình Android – http://laptrinhdidong.vn Page 2 . android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > < ;WebView android:id="@+id /webView1 " android:layout_weight="1" android:layout_width="match_parent" . setContentView(R.layout.main); WebView w = (WebView) findViewById(R.id .webView1 ); w.getSettings().setBuiltInZoomControls(true); w.loadUrl("file:///android_asset/england.jpg"); } } Lập trình Android. android:layout_width="match_parent" android:layout_height="match_parent" /> <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content"

Ngày đăng: 10/08/2014, 11:20

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan