O'Reilly logo

Mastering Android Development with Kotlin by Miloš Vasić

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Make your buttons look pretty

We colored our buttons and defined states for them. We colored each state differently. We have colors for disabled state, for enabled, and pressed states. Now we will go one step further. We will make our buttons rounded and color them with a gradient instead of a solid color. We will prepare a layout for a new button style. Open the activity_todo layout and modify the buttons container:

    <LinearLayout 
      android:background="@color/grey_text_light" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      android:weightSum="1"> 
           
      ... 
 
     </LinearLayout> 

We set the background the same as the one we used for the edit text field. Buttons will be rounded so we want them on ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required