1.shape Usage Examples:
<Shape> <!--Solid - <SolidAndroid:color= "#ff9d77"/> <!--Gradient - <GradientAndroid:startcolor= "#ff8c00"Android:endcolor= "#FFFFFF"Android:angle= "+" /> <!--Strokes - <StrokeAndroid:width= "2DP"Android:color= "#dcdcdc" /> <!--Rounded Corners - <CornersAndroid:radius= "2DP" /> <paddingAndroid:left= "10DP"Android:top= "10DP"Android:right= "10DP"Android:bottom= "10DP" /> </Shape>
- Solid: Filled is the meaning of filling
- Gradient: Gradient
Android:startcolor and Android:endcolor are start and end colors respectively, Android:angle is the gradient angle and must be an integer multiple of 45.
In addition, the default mode of the gradient is android:type= "linear", that is, linear gradient, you can specify the gradient to radial gradient, android:type= "radial", radial gradient needs to specify the radius android:gradientradius= "50".
Android:width= the width of the "2DP" stroke, android:color the color of the stroke.
We can also make the stroke into a dashed form, set in the following way:
Android:dashwidth= "5DP"
android:dashgap= "3DP"
Where android:dashwidth represents the width of a horizontal line such as '-', android:dashgap represents the distance between them.
The Android:radius is the radian of the angle, and the larger the value the greater the rounded.
2.selector Usage Examples:
<?XML version= "1.0" encoding= "Utf-8"?><selectorxmlns:android= "Http://schemas.android.com/apk/res/android"> <Itemandroid:state_checked= "true"android:drawable= "@drawable/enabled_on_pressed" /> <Itemandroid:state_pressed= "true"android:drawable= "@drawable/enabled_on_pressed" /> <Itemandroid:drawable= "@drawable/disabled_off" /> </selector>
The following properties can be found in the drawable item:
Android:drawable= "@[package:]drawable/drawable_resource"
Android:state_pressed=["true" | "False"]
Android:state_focused=["true" | "False"]
Android:state_selected=["true" | "False"]
Android:state_active=["true" | "False"]
Android:state_checkable=["true" | "False"]
Android:state_checked=["true" | "False"]
Android:state_enabled=["true" | "False"]
Android:state_window_focused=["true" | "False"]
The item order is fastidious, and the more detailed the condition is, the earlier it should be placed.
Android shape and selector