public SearchCrossDrawable(Context context, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) { super(context, defStyleAttr, defStyleRes); final TypedArray typedArray = context.getTheme() .obtainStyledAttributes(null, R.styleable.SearchCrossToggle, defStyleAttr, defStyleRes); float radius = round(typedArray.getDimension(R.styleable.SearchCrossToggle_td_searchRadius, 0)); float searchLength = round(typedArray.getDimension(R.styleable.SearchCrossToggle_td_searchLength, 0)); float crossLength = round(typedArray.getDimension(R.styleable.SearchCrossToggle_td_crossLength, 0)); typedArray.recycle(); SearchModel search = new SearchModel(radius, searchLength); CrossModel cross = new CrossModel(crossLength); add(search.handle, cross.upLine); add(search.topRightQuadrant, cross.upLine); add(search.bottomRightQuadrant, cross.upLine); add(search.topLeftQuadrant, cross.downLine); add(search.bottomLeftQuadrant, cross.downLine); } }