@@ -7,18 +7,22 @@ Then select library folder from project. And start use. </p>
7
7
<p > >=API 8 </p >
8
8
9
9
<h2 > Reference </h2 >
10
+ <p > Default image position is left and centered text in button. When image is bigger than half of width, weight automatically is setting to 1. <br >
11
+ Only when image is in horizontal position text can be center. </p >
10
12
<h3 > XML tag's </h3 >
11
13
12
14
This is the base tag of CustomButton:<br >
13
15
``` xml
14
- <pl .sigmapoint.customview.CustomButton<br>
16
+ <pl .sigmapoint.customview.CustomButton
15
17
android : id =" @+id/sigmapoint_button"
16
18
android : layout_width =" match_parent"
17
19
android : layout_height =" match_parent"
18
20
android : text =" text" />
19
21
```
20
- <p > You can specify the following things:<br >
21
- cb_background - background color of normal button {format - color} - recommended <br >
22
+ <p > You can specify the following things:
23
+ cb_primary_color - \/
24
+ cb_secondary_color - you can specify only two colors for all button. But it will be override by background, text, frame color. {format - color} <br >
25
+ cb_background - background color of normal button {format - color} <br >
22
26
cb_background_pressed - background color of pressed button {format - color} <br >
23
27
cb_background_disabled - background color of disabled button {format - color} <br >
24
28
cb_background_state_list - {format - ColorStateList} <br >
@@ -33,6 +37,7 @@ cb_text_padding_top - {format - dimension} <br>
33
37
cb_text_padding_right - {format - dimension} <br >
34
38
cb_text_padding_bottom - {format - dimension} <br >
35
39
cb_text_weight - {format - integer} <br >
40
+ cb_text_center or android: textAlignment - only works when image weight doesn't specify. Center text in button. {format - boolean or only "center" value} <br >
36
41
<br >
37
42
cb_shape_radius - corner radius {format - dimension}<br >
38
43
cb_shape_type - shape type, you can choose: rect or oval <br >
@@ -49,6 +54,10 @@ cb_image - image source {format - drawable or color} <br>
49
54
cb_image_normal - normal state image source (if you choose cb_image, it will be override) {format - drawable or color} <br >
50
55
cb_image_disabled - disabled state image source (if you choose cb_image, it will be override) {format - drawable or color} <br >
51
56
cb_image_pressed - pressed state image source (if you choose cb_image, it will be override) {format - drawable or color} <br >
57
+ cb_image_color_normal - only for image {format - color} <br >
58
+ cb_image_color_pressed - only for image {format - color} <br >
59
+ cb_image_color_disable - only for image {format - color} <br >
60
+ cb_image_color_list - only for image {format - colorStateList} <br >
52
61
cb_image_padding - {format - dimension} <br >
53
62
cb_image_padding_left - {format - dimension} <br >
54
63
cb_image_padding_top - {format - dimension} <br >
@@ -58,7 +67,10 @@ cb_image_scale_type - {center, center_inside, center_crop, fit_center, fit_start
58
67
cb_image_weight - {format - integer} </p >
59
68
<h3 > Java Code </h3 >
60
69
``` java
61
- CustomButton(Context context, LayoutParams layoutParams, int backgroundColor, int textColor, Drawable icon)
70
+ CustomButton(Context context, LayoutParams layoutParams, int primaryColor, int secondaryColor, Drawable icon)
71
+ setPrimaryColor(int color)
72
+ setSecondaryColor(int color)
73
+ setMainColors(int primaryColor, int secondaryColor)
62
74
setShapeBackground(int shapeType, int shapeRadius)
63
75
setBackgroundColorStateList(ColorStateList colorStateList)
64
76
setBackgroundColor(int color)
@@ -74,6 +86,7 @@ setFrameColorDisabled(int color)
74
86
setFrameSize(float frameSize)
75
87
removeFrame()
76
88
setText(String text)
89
+ setTextCenter(boolean center)
77
90
setTextColor(int color)
78
91
setTextColorNormal(int color)
79
92
setTextColorPressed(int color)
@@ -84,6 +97,10 @@ setTextPadding(int[] padding) - int[4]{CustomButton.LEFT, CustomButton.TOP, Cust
84
97
setTextParams(int weight, int [] padding)
85
98
setImage(int position, Drawable drawableNormal, Drawable drawablePressed, Drawable drawableDisabled, ImageView . ScaleType scaleType, int weight, int [] padding)
86
99
setImage(int position, Drawable drawable, ImageView . ScaleType scaleType, int weight, int [] padding)
100
+ setImageColors(int nomal, int pressed, int disabled)
101
+ setImageNormalColor(int color)
102
+ setImagePressedColor(int color)
103
+ setImageDisableColor(int color)
87
104
setElevationEnabled(boolean enabled)
88
105
and evry XML tag have getter
89
106
```
0 commit comments