ViewWidthの設定

1610 ワード

 1 public class ViewMeasuare extends View {
 2 
 3     public ViewMeasuare(Context context, AttributeSet attrs) {
 4         super(context, attrs);
 5     }
 6     
 7     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
 8         super.onMeasure(widthMeasureSpec, heightMeasureSpec);
 9         setMeasuredDimension(780, 120);
10     }
11     
12 }
setMeasuredDimension