1 package com.android.test.hwui; 2 3 import android.app.Activity; 4 import android.os.Bundle; 5 import android.util.Log; 6 import android.view.View; 7 import android.view.ViewGroup; 8 9 public class ZOrderingActivity extends Activity { 10 @Override onCreate(Bundle savedInstanceState)11 protected void onCreate(Bundle savedInstanceState) { 12 super.onCreate(savedInstanceState); 13 setContentView(R.layout.z_ordering); 14 15 ViewGroup grandParent = findViewById(R.id.parent); 16 if (grandParent == null) throw new IllegalStateException(); 17 View.OnClickListener l = new View.OnClickListener() { 18 @Override 19 public void onClick(View v) {} 20 }; 21 for (int i = 0; i < grandParent.getChildCount(); i++) { 22 ViewGroup parent = (ViewGroup) grandParent.getChildAt(i); 23 for (int j = 0; j < parent.getChildCount(); j++) { 24 parent.getChildAt(j).setOnClickListener(l); 25 } 26 } 27 } 28 } 29