I'm trying to draw this shape including 2 buttons one for patient and other for doctor how can i do something like that ?

            Asked
            
        
        
            Active
            
        
            Viewed 79 times
        
    -2
            
            
         
    
    
        Mahmoud Elsakka
        
- 47
- 8
- 
                    1I think this is what you are looking for: https://stackoverflow.com/questions/18335239/android-toggle-button-custom-look – Androidz May 06 '19 at 14:46
1 Answers
1
            Well there are lot of ways to do this, I did it using shape and this is the output
You've to create a oval_left.xml and oval_right.xml and then create two Buttons and apply these backgrounds to them.
This is the oval_left.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
           android:shape="rectangle" android:padding="40dp">
<solid android:color="@color/colorPrimary"/>
<corners
    android:bottomRightRadius="0dp"
    android:bottomLeftRadius="20dp"
    android:topLeftRadius="20dp"
    android:topRightRadius="0dp"/>
</shape>
And this is the oval_right.xml is the same but changing the values and color
<shape xmlns:android="http://schemas.android.com/apk/res/android"
   android:shape="rectangle" android:padding="40dp">
<solid android:color="@android:color/white"/>
<corners
        android:bottomRightRadius="20dp"
        android:bottomLeftRadius="0dp"
        android:topLeftRadius="0dp"
        android:topRightRadius="20dp"/>
</shape>
Hope it is what you are looking for.
Also if you want to check the full code take a look at this repository : shapeovalandrectangleview
 
    
    
        Skizo-ozᴉʞS ツ
        
- 19,464
- 18
- 81
- 148
