标签:
1 package com.example.ele_me.activity; 2 3 import android.annotation.SuppressLint; 4 import android.app.Activity; 5 import android.os.Bundle; 6 import android.support.v4.widget.SlidingPaneLayout; 7 import android.view.View; 8 import android.view.Window; 9 import android.view.View.OnClickListener; 10 import android.webkit.WebChromeClient; 11 import android.webkit.WebView; 12 import android.widget.ImageView; 13 import android.widget.LinearLayout; 14 import android.widget.LinearLayout.LayoutParams; 15 import android.widget.TextView; 16 17 import com.example.ele_me.R; 18 import com.example.ele_me.util.InjectView; 19 import com.example.ele_me.util.Injector; 20 21 public class DianPingWebActivity extends Activity { 22 23 //@InjectView是用於取代findViewById的用法,但必須謹記要另外建立InjectView.java和Injector.java檔。 24 @InjectView(R.id.webview_common) 25 private WebView mWebView; 26 @InjectView(R.id.iv_head_left) 27 private ImageView head_left; 28 @InjectView(R.id.linear_above_toHome) 29 private LinearLayout above_toHome; 30 @InjectView(R.id.tv_common_above_head) 31 private TextView above_tittle; 32 33 34 //確保新舊版本相容 35 @SuppressLint("NewApi") 36 @Override 37 protected void onCreate(Bundle savedInstanceState) { 38 // TODO Auto-generated method stub 39 super.onCreate(savedInstanceState); 40 requestWindowFeature(Window.FEATURE_NO_TITLE); 41 setContentView(R.layout.dianping_main); 42 //寫入所有InjectorView的對象,並初始化。 43 Injector.get(this).inject();// init views 44 initView(); 45 setListener(); 46 } 47 48 private void setListener() { 49 // TODO Auto-generated method stub 50 //監聽above_toHome.Layout.xml。為何要設置這個onClickListener? 51 above_toHome.setOnClickListener(new OnClickListener() { 52 public void onClick(View v) { 53 finish(); 54 55 } 56 }); 57 58 } 59 60 private void initView() { 61 above_tittle.setText("眾籌之星"); 62 head_left.setImageResource(R.drawable.abc_ic_ab_back_holo_dark); 63 mWebView.loadUrl("http://www.dsestar.weebly.com"); 64 65 mWebView.setWebChromeClient(new WebChromeClient() { 66 public void onProgressChanged(WebView view, int progress) { 67 } 68 }); 69 70 } 71 72 }
安卓中級教程(11):深入研究餓了麼的各個java檔運作關係(1)
标签:
原文地址:http://www.cnblogs.com/kanchihong/p/4549124.html