1 package com.xtremelabs.robolectric.shadows; 2 3 import android.content.Context; 4 import android.util.AttributeSet; 5 import android.view.View.MeasureSpec; 6 import android.view.ViewGroup; 7 import android.widget.FrameLayout; 8 9 import com.xtremelabs.robolectric.internal.Implementation; 10 import com.xtremelabs.robolectric.internal.Implements; 11 12 /** 13 * Shadow for {@link FrameLayout} that simulates its implementation. 14 */ 15 @SuppressWarnings("UnusedDeclaration") 16 @Implements(FrameLayout.class) 17 public class ShadowFrameLayout extends ShadowViewGroup { 18 __constructor__(Context context, AttributeSet attributeSet, int defStyle)19 public void __constructor__(Context context, AttributeSet attributeSet, int defStyle) { 20 setLayoutParams(new ViewGroup.MarginLayoutParams(0, 0)); 21 super.__constructor__(context, attributeSet, defStyle); 22 } 23 24 @Implementation onMeasure(int widthMeasureSpec, int heightMeasureSpec)25 public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 26 int width = MeasureSpec.getSize(widthMeasureSpec); 27 int height = MeasureSpec.getSize(heightMeasureSpec); 28 29 layout(right, top, right + width, top + height); 30 } 31 } 32