Java Code Examples for android.view.ViewGroup#getHitRect()

The following examples show how to use android.view.ViewGroup#getHitRect() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PendIntentCompat.java    From container with GNU General Public License v3.0 6 votes vote down vote up
private void setIntentByViewGroup(RemoteViews remoteViews, ViewGroup viewGroup, List<RectInfo> list) {
		int count = viewGroup.getChildCount();
		Rect p = new Rect();
		viewGroup.getHitRect(p);
		for (int i = 0; i < count; i++) {
			View v = viewGroup.getChildAt(i);
			if (v instanceof ViewGroup) {
				// linearlayout
				setIntentByViewGroup(remoteViews, (ViewGroup) v, list);
			} else if (v instanceof TextView || v instanceof ImageView) {
				// textview
				Rect rect = getRect(v);
				RectInfo next = findIntent(rect, list);
				if (next != null) {
//					VLog.d(TAG, next.rect+":setPendIntent:"+i);
//                    remoteViews.setImageViewBitmap(v.getId(), next.testBg);
					remoteViews.setOnClickPendingIntent(v.getId(), next.mPendingIntent);
				}
			}
		}
	}