How to draw a smaller ShapeDrawable inside another shapeDrawable programmatically

Im trying to draw a smaller circle within another circle.
It seems pretty simple but Im having trouble with this and couldnt find an answer.
The code im using is:

    ShapeDrawable biggerCircle= new ShapeDrawable( new OvalShape());
    biggerCircle.setIntrinsicHeight( 60 );
    biggerCircle.setIntrinsicWidth( 60);
    biggerCircle.setBounds(new Rect(0, 0, 60, 60));
    biggerCircle.getPaint().setColor(Color.BLUE);

    ShapeDrawable smallerCircle= new ShapeDrawable( new OvalShape());
    smallerCircle.setIntrinsicHeight( 10 );
    smallerCircle.setIntrinsicWidth( 10);
    smallerCircle.setBounds(new Rect(0, 0, 10, 10));
    smallerCircle.getPaint().setColor(Color.BLACK);
    smallerCircle.setPadding(50,50,50,50);

    LayerDrawable composite1 = new LayerDrawable(new Drawable[] biggerCircle,smallerCircle,});

But that didnt work, what happens is that the smaller circle get as big as the the bigger circle. So the only thing showing is as black circle with the size of the biggerCircle.
I would apriciate if someone could help. Thanks in advance.

  • Google Maps api v2 class not found
  • Android TabLayout Android Design
  • A Switch Java problem : case expressions must be constant expressions
  • What are the implications of VMDebug.startGC in a traceview file
  • Android: How to collapse status bar on android 4.2?
  • Can't find “Sync Project with Gradle Files” button in IntelliJ IDEA
  • Related posts:

    In android app Toolbar.setTitle method has no effect – application name is shown as title
    Is using event library like Otto or EventBus a recommended way to handle relations between Activitie...
    How to create custom button in Android using XML Styles
    How to set height of one layout component to the same height of another component?
    Top-most and Bottom-most Horizonal Divider does not show up in ListView
    Application class does it run on UI thread or?
  • Create borders on a android view in drawable xml, on 3 sides?
  • Face Detection in Android without user interaction
  • Items not showing in the ActionBar with showAsAction=“always”
  • How to automatically increase and release signed apk in Android Studio using Gradle script
  • Is it possible to start a call in Google Hangout using code?
  • SQLite rawQuery selectionArgs and Integers Fields
  • One Solution collect form web for “How to draw a smaller ShapeDrawable inside another shapeDrawable programmatically”

    Change the order,

    Drawable[] d = {smallerCircle,biggerCircle};
    
    LayerDrawable composite1 = new LayerDrawable(d);
    

    try like this

            ShapeDrawable biggerCircle= new ShapeDrawable( new OvalShape());
            biggerCircle.setIntrinsicHeight( 60 );
            biggerCircle.setIntrinsicWidth( 60);
            biggerCircle.setBounds(new Rect(0, 0, 60, 60));
            biggerCircle.getPaint().setColor(Color.BLUE);
    
            ShapeDrawable smallerCircle= new ShapeDrawable( new OvalShape());
            smallerCircle.setIntrinsicHeight( 10 );
            smallerCircle.setIntrinsicWidth( 10);
            smallerCircle.setBounds(new Rect(0, 0, 10, 10));
            smallerCircle.getPaint().setColor(Color.BLACK);
            smallerCircle.setPadding(50,50,50,50);
            Drawable[] d = {smallerCircle,biggerCircle};
    
            LayerDrawable composite1 = new LayerDrawable(d);
    
            btn.setBackgroundDrawable(composite1);  
    

    enter image description here

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.