LinearLayout に 2 つの ImageView、1 つのテキスト フィールド、1 つの WebView があります。ImageView リスナーが機能していません。ここに私のXMLがあります:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_main"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="back"
android:adjustViewBounds="true"
android:clickable="true"
android:src="@drawable/back_icon" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:clickable="true"
android:contentDescription="forward"
android:src="@drawable/back_icon"/>
<EditText
android:id="@+id/adressBar"
android:imeOptions="actionDone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:ems="10" >
</EditText>
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
これが私のJavaコードです。Log.d ステートメントは起動していないため、呼び出されていないことは間違いありません。
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (savedInstanceState == null) {
L.d(">>onCreateView", "savedInstanceState null");
}
View v = inflater.inflate(R.layout.browser,null);
mWebView = (WebView) v.findViewById(R.id.webView);
back =(ImageView) v.findViewById(R.id.imageView1);
back.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.d("backkkkkkkkkkkkkkkk", "msg");
}
});
return v;
}