|
| 1 | +<h1> Sigmapoint Custom Button </h1> |
| 2 | + |
| 3 | +<p> This button can help you to faster create button with background drawable, text color state, image inside button, |
| 4 | +you only must specify colors, position, drawables, etc in xml button tags.</p> |
| 5 | +<p> If you want start use this button, you must clone or download this repository. Next in Android Studio File -> New -> Import module. |
| 6 | +Then select library folder from project. And start use. </p> |
| 7 | +<p> >=API 8 </p> |
| 8 | + |
| 9 | +<h2> Reference </h2> |
| 10 | +<h3> XML tag's </h3> |
| 11 | + |
| 12 | +This is the starter tags of CustomButton:<br> |
| 13 | +\<pl.sigmapoint.customview.CustomButton<br> |
| 14 | +    android:id="@+id/sigmapoint_button"<br> |
| 15 | +    android:layout_width="match_parent"<br> |
| 16 | +    android:layout_height="match_parent"<br> |
| 17 | +    android:text="text"/><br> |
| 18 | +</br> |
| 19 | +<p> You can specify the following things:<br> |
| 20 | +cb_background - background color of normal button {format - color} - recommended <br> |
| 21 | +cb_background_pressed - background color of pressed button {format - color} <br> |
| 22 | +cb_background_disabled - background color of disabled button {format - color} <br> |
| 23 | +cb_background_state_list - {format - ColorStateList} <br> |
| 24 | +<br> |
| 25 | +cb_text_color_pressed - color of pressed text {format - color} <br> |
| 26 | +cb_text_color_disabled - color of disabled text {format - color} <br> |
| 27 | +cb_text_color or android:textColor - color of normal text {format - color} <br> |
| 28 | +cb_text_size - {format - dimension} <br> |
| 29 | +cb_text_padding - {format - dimension} <br> |
| 30 | +cb_text_padding_left - {format - dimension} <br> |
| 31 | +cb_text_padding_top - {format - dimension} <br> |
| 32 | +cb_text_padding_right - {format - dimension} <br> |
| 33 | +cb_text_padding_bottom - {format - dimension} <br> |
| 34 | +<br> |
| 35 | +cb_shape_radius - corner radius {format - dimension}<br> |
| 36 | +cb_shape_type - shape type, you can choose: rect or oval <br> |
| 37 | +cb_frame_color - {format - color} <br> |
| 38 | +cb_frame_color_pressed - {format - color} <br> |
| 39 | +cb_frame_color_disabled - {format - color} <br> |
| 40 | +cb_frame_size - frame height {format - dimension} <br> |
| 41 | +cb_frame_state_list - {format - ColorStateList} <br> |
| 42 | +<br> |
| 43 | +cb_elevation_enabled - on >=API 21 devices enable elvation (default) {format - boolean} <br> |
| 44 | +<br> |
| 45 | +cb_image_position - image position in button, can choose left, top, right, bottom <br> |
| 46 | +cb_image - image source {format - drawable or color} <br> |
| 47 | +cb_image_normal - normal state image source (if you choose cb_image, it will be override) {format - drawable or color} <br> |
| 48 | +cb_image_disabled - disabled state image source (if you choose cb_image, it will be override) {format - drawable or color} <br> |
| 49 | +cb_image_pressed - pressed state image source (if you choose cb_image, it will be override) {format - drawable or color} <br> |
| 50 | +cb_image_padding - {format - dimension} <br> |
| 51 | +cb_image_padding_left - {format - dimension} <br> |
| 52 | +cb_image_padding_top - {format - dimension} <br> |
| 53 | +cb_image_padding_right - {format - dimension} <br> |
| 54 | +cb_image_padding_bottom - {format - dimension} <br> </p> |
| 55 | +<h3> Java Code </h3> |
| 56 | +setShapeBackground(int shapeType, int shapeRadius) <br> |
| 57 | +setBackgroundColorStateList(ColorStateList colorStateList) <br> |
| 58 | +setFrame(int color, float size) <br> |
| 59 | +setFrame(ColorStateList colorStateList, float size) <br> |
| 60 | +setFrameSize(float frameSize) <br> |
| 61 | +removeFrame() <br> |
| 62 | +setTextColor(int color) <br> |
| 63 | +setTextColor(ColorStateList colorStateList) <br> |
| 64 | +setText(String text) <br> |
| 65 | +setTextSize(float size) <br> |
| 66 | +setTextPadding(int[] padding) - int[4]{CustomButton.LEFT, CustomButton.TOP, CustomButton.RIGHT, CustomButton.BOTTOM} <br> |
| 67 | +setImage(int position, Drawable drawableNormal, Drawable drawablePressed, Drawable drawableDisabled, int[] padding) <br> |
| 68 | +setImage(int position, Drawable drawable, int[] padding) <br> |
| 69 | +setElevationEnabled(boolean enabled) <br> |
| 70 | +and evry HTML tag have getter <br> |
0 commit comments