Button, circle button, image button with text, circle button
Demo2 \ button_demo \ src \ main \ res \ drawable \ button_selector.xml
1 <?xml version="1.0" encoding="utf-8"?>2 <selector xmlns:android="http://schemas.android.com/apk/res/android">3 <item android:state_pressed="true" android:drawable="@mipmap/favoured_icon"></item>4 <item android:state_pressed="false" android:drawable="@mipmap/s_rate_crown"></item>5 </selector>
Demo2 \ button_demo \ src \ main \ res \ layout \ activity_main.xml
1 <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" 2 xmlns: tools = "http://schemas.android.com/tools" 3 android: layout_width = "match_parent" 4 android: layout_height = "match_parent" 5 android: orientation = "vertical" 6 tools: context = ". mainActivity "> 7 <! -- Text shadow Button --> 8 <Button 9 android: layout_width = "wrap_content" 10 android: layout_height = "wrap_content" 11 android: shadowColor = "# aa5" 12 android: shadowDx = "5" 13 android: shadowDy = "5" 14 android: shadowRadius = "1" 15 android: text = "text shadowRadius =" 16 android: textSize = "12dp"/> 17 <! -- Normal text button --> 18 <Button19 android: layout_width = "wrap_content" 20 android: layout_height = "wrap_content" 21 android: background = "# ff1827" 22 android: text = "normal button" 23 android: textSize = "10dp"/> 24 <! -- Image button with text --> 25 <Button26 android: layout_width = "wrap_content" 27 android: layout_height = "wrap_content" 28 android: background = "@ drawable/button_selector" 29 android: text = "text-carrying image buttons" 30 android: textSize = "11dp"/> 31 </LinearLayout>