androidxmlandroid-layoutxml-drawable

Curve Design in drawable xml or paint draw using programmatically


I have checked Stack Overflow questions & also check some other code books. but i am not satisfied & not find out in similar questions. I don't have any code but I have imaged this type of layout implementation. see attached image layout.enter image description here


Solution

  • Please use below code for if you have shape XML

    Drawable tempDrawable = getResources().getDrawable(R.drawable.library_cirecle);
    LayerDrawable bubble = (LayerDrawable) tempDrawable; (cast to root element in xml)
    GradientDrawable solidColor = (GradientDrawable) bubble.findDrawableByLayerId(R.id.outerRectangle);
    solidColor.setColor(colorToPaint);
    imageView.setImageDrawable(tempDrawable);
    

    if u do not have code then make pdf or SWF file and import and make for shape in XML by using android editor

    enter image description here