# Properties

{% hint style="info" %}
On this page widgets and layouts will be refired collectively as widgets.
{% endhint %}

Open the properties of a widget by clicking on that widget:

![](https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-MJXgaAM0i_fFGx1UttJ%2F-MJXn4d2rnQzkj9z-DAB%2Fopen_properties_bottom.gif?alt=media\&token=55ee78f3-af68-4422-b88a-22d5732d44d9)

You can also see a complete list of properties by clicking the widget and clicking *see all*. There are certain properties that can only be changed in the *see all*  list, for example the `enabled` property, or the `single line` property of an edittext.

![Accessing the see all list](https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-MJXgaAM0i_fFGx1UttJ%2F-MJXo4_IGqVs_Uu6K4B5%2Fopen_properties_all.gif?alt=media\&token=066871e0-1e0e-455e-bfb5-e9731d703242)

## List of properties

#### <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3BDIPN1ImsM_X4s8kj%2F-M3BFp0vwm2Vx66qeB_Y%2Frename_96_blue.png?alt=media&#x26;token=2e19e83a-1181-4215-b5aa-9b8b3d13e5a9" alt="" data-size="line"> Widget ID

This is unique ID of widget or layout you used. While programming the app, it is needed.

{% hint style="success" %}
For large apps, make your widget's ID rememberable, since this is how you will be able to find widgets when programming your app. For example, for title, "txt\_title", "btn\_submit" etc.
{% endhint %}

### Layout Properties

#### <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3BGeZOmokH07NlVat1%2F-M3BIoGQdED50Uzqt7kR%2Fheight_96.png?alt=media&#x26;token=ff1e48ae-d3a7-42a4-b52c-c709d756ddeb" alt="" data-size="line"> Width and height

You can set your widget's dimensions. There are few types available.

| Type           | Explanation                                                                                                                                                                                                                   |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| match\_parent  | The width/height will be matched to the layout it is inside of, in simple words, it will be maximum height/width.                                                                                                             |
| wrap\_content  | The width/height will be set automatically according to contents in it. It will only take up what the widget needs.                                                                                                           |
| Custom (in dp) | Set custom height/width according to requirement. For example, for small icon, you can use 40x40 (width x height). Keep in mind that if you used a fixed dp, the widget may be cut off in devices with smaller sized screens. |

#### <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3BIsTsqy5xkUYrfjB-%2F-M3BJUpRif_aEGP-6k8U%2Fcollect_48.png?alt=media&#x26;token=3729a03a-6fbb-49ad-901a-ef42e6aec326" alt="" data-size="line"> Padding

Padding is used to add space **inwards** of the widget

{% tabs %}
{% tab title="Input" %}
Padding is added to "Linear Layout"

![Padding (Pic. 4)](https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3BJfJMro_mBKq9UXR_%2F-M3BLqc4_ntAsjJ0SD5g%2Fpadding_menu.jpg?alt=media\&token=5675ccd3-6b96-4e1a-8cae-10671531206a)
{% endtab %}

{% tab title="Output" %}
A padding of 8 dp is applied on *Linear Layout*

![Output (Pic. 5)](https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3BMOxRT12uc9i_rLNG%2F-M3BP-ERztpFdm8CbtXU%2Fpadding_output.jpg?alt=media\&token=e5b73aae-0878-4d90-9341-1f9fb5f3154d)
{% endtab %}
{% endtabs %}

#### <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3BP5RzMnfHcGnQkAMq%2F-M3BQct3Aj4S9RL45v71%2Finsert_white_space_48.png?alt=media&#x26;token=1c65ca83-ad5d-4912-ba0a-6965a9199aa7" alt="" data-size="line"> Margin

Margin is used to add space **outwards** of the widget. It is same as [padding](#padding) but outside of the widget.

#### <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3EauudxS6ims2GzruW%2F-M3EbhyvCCrqwWhUrZjH%2Fgravity_96.png?alt=media&#x26;token=f0c4c4eb-abe0-4c69-a2f2-89682da8a997" alt="" data-size="line"> Gravity and Layout Gravity

In simple word, gravity is used to set alignment of **contents in the widget** whereas layout gravity is used to set alignment of **the widget.**

![Gravity Example (Pic. 6)](https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3EauudxS6ims2GzruW%2F-M3EmcRd4fiiDcHWx1ej%2Fgravity.jpg?alt=media\&token=39eefa44-69e1-4778-8368-fcb219f96963)

#### <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3Es36jvBC-pLi7AZPP%2F-M3EsLQnqfNr3utGHAJt%2Fone_to_many_48.png?alt=media&#x26;token=a9c7b60b-b020-4ec7-bf21-163adfa64832" alt="" data-size="line"> **Weight**

Weight is very important property, even if it is used rarely. It helps to keep widget stable. It is better that setting a fixed dp, because it will change the widget's size to fit the device it is on. For more information, see [this article](https://medium.com/sketchware/tip-understanding-and-using-weight-property-2d542d2de0bf).\
**Examples:**

{% tabs %}
{% tab title="Example 1" %}
It can be used to set width of two or more widgets equal by setting both widgets gravity to 1 (or any equal value).

![Example 1 (Pic. 7)](https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3FCcGfT80n9c_fhHAv%2F-M3FCitVP-ep2K4y91Xv%2Fweight1.jpg?alt=media\&token=1a2b5238-6bcc-4611-a6f0-e68c9f07ee12)
{% endtab %}

{% tab title="Example 2" %}
It can be used to fit the widget to screen like this:

![Example 2 (Pic. 8)](https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3FCcGfT80n9c_fhHAv%2F-M3FCfU4T1rMsGMGRB1c%2Fweigh2.jpg?alt=media\&token=1769a522-be34-4120-9c8e-000a5c66b17c)
{% endtab %}
{% endtabs %}

#### <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3Es36jvBC-pLi7AZPP%2F-M3EsLQnqfNr3utGHAJt%2Fone_to_many_48.png?alt=media&#x26;token=a9c7b60b-b020-4ec7-bf21-163adfa64832" alt="" data-size="line"> Weight Sum

This is one of most unused thing in Sketchware. Nobody has even seen someone using it yet, so there is no information available. You can refer to Stackoverflow if you needed it. <https://stackoverflow.com/a/7452788/9300428>

![](https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-MGBkxd9CLqz9eLC1sOZ%2F-M3FKT-jjALSR6Mr7A4F%2Fno_need_2_thanks.jpg?alt=media\&token=53ff2c0f-de62-47e1-bb9b-7125b0139bbb)

### Text Properties

Text properties are available only for text containing widgets i.e.:

* TextView <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3EmlQGfOfyVOYtEnjw%2F-M3EoQe_RRhE8a3-oSAD%2Fwidget_text_view.png?alt=media&#x26;token=8f7dbecd-e97a-47fb-8a7e-aae045f119c7" alt="" data-size="line">
* EditText  <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3EmlQGfOfyVOYtEnjw%2F-M3EouoVism9gIShtu5r%2Fwidget_edit_text.png?alt=media&#x26;token=1cccb828-214c-4c9e-99c7-d17d58326a0d" alt="" data-size="line">&#x20;
* Button  <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3EmlQGfOfyVOYtEnjw%2F-M3Ep0HNmpZ1E0YFKprj%2Fwidget_button.png?alt=media&#x26;token=9c47574f-a617-496b-819b-c8f7e2d7d949" alt="" data-size="line">&#x20;
* CheckBox  <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3EmlQGfOfyVOYtEnjw%2F-M3Ep3pfhTXn1IbJ2swk%2Fwidget_check_box.png?alt=media&#x26;token=068e794d-ed2d-4bd2-9ad7-e8648fe7d50f" alt="" data-size="line">&#x20;
* Switch  <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3EmlQGfOfyVOYtEnjw%2F-M3Ep7ViJc8uX7hw-w9S%2Fwidget_switch.png?alt=media&#x26;token=e900a273-2001-432b-8538-cfbcec10a6ce" alt="" data-size="line">&#x20;

| Title                                                                                                                                                                                                                                                                                        | Explanation                                               |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
| <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3EmlQGfOfyVOYtEnjw%2F-M3EpgI8RNgfiays7W2I%2Fabc_96.png?alt=media&#x26;token=ffd12740-d7ff-48b6-93fb-b1806965b934" alt="" data-size="line"> text                          | Used to set text of the widget                            |
| <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3EmlQGfOfyVOYtEnjw%2F-M3EpnBKB15OG_P4kSZB%2Fevent_on_text_changed_48dp.png?alt=media&#x26;token=3c048e10-251c-427a-bcaf-ccf924a9cb03" alt="" data-size="line"> text size | Used to set text size of the widget                       |
| <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3EmlQGfOfyVOYtEnjw%2F-M3EpzjEzL58mXoP6C_z%2Fabc_96_color.png?alt=media&#x26;token=265456bd-c55b-49b7-91e6-5254574e6592" alt="" data-size="line"> text style              | Used to format text in **bold**, *italic* or ***both***   |
| <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3EmlQGfOfyVOYtEnjw%2F-M3Eq4h4Z4P3xVWj81KZ%2Fcolor_palette_48.png?alt=media&#x26;token=95fcd8ab-a134-4f5b-8718-23e84cd59f3d" alt="" data-size="line"> text color          | Used to set color of text                                 |
| <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3FE3bZd_DtYDt37Idc%2F-M3FGMgklYfulTABmqPD%2Fhelp_96_blue.png?alt=media&#x26;token=c904c549-d086-4c22-a936-b28fb63c7e46" alt="" data-size="line"> hint                    | It is text shown when edittext is empty                   |
| <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3EmlQGfOfyVOYtEnjw%2F-M3Eq4h4Z4P3xVWj81KZ%2Fcolor_palette_48.png?alt=media&#x26;token=95fcd8ab-a134-4f5b-8718-23e84cd59f3d" alt="" data-size="line"> hint color          | Used to set color of hint of edittext                     |
| <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3FE3bZd_DtYDt37Idc%2F-M3FGbMKMu_M33Jt5wb5%2Fhorizontal_line_48.png?alt=media&#x26;token=f7a3e9eb-e956-4f1c-8e5f-6fff311e7a0a" alt="" data-size="line"> single line       | Restrict the widget to use only single line               |
| <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3FE3bZd_DtYDt37Idc%2F-M3FGg9ItD4GQcDopXy5%2Fnumbers_48.png?alt=media&#x26;token=303c298a-5bba-4cc2-864e-b510d77916d7" alt="" data-size="line"> lines                     | Restrict the widget to use only specified number of lines |
| <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3FE3bZd_DtYDt37Idc%2F-M3FGk1qfbOz6KBB04z5%2Fkeyboard_48.png?alt=media&#x26;token=89db284f-8515-47e9-8b55-d5c01846c96d" alt="" data-size="line"> input type               | Used to accept only specific type of text                 |
| <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3FE3bZd_DtYDt37Idc%2F-M3FGk1qfbOz6KBB04z5%2Fkeyboard_48.png?alt=media&#x26;token=89db284f-8515-47e9-8b55-d5c01846c96d" alt="" data-size="line"> ime option               | Used to set keyboard's main button                        |

### Image Properties

#### <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3kjPErkJ9W5XjY27oH%2F-M3klEs_SPHH2qCsW9sC%2Fic_picture_48dp.png?alt=media&#x26;token=f5dc4572-fec0-46c9-875f-920c052b940d" alt="" data-size="line"> Image (Only in ImageView)

It set image to the imageview. The Image should be available in [Image Manager](https://wiki.sketchub.in/configuration/image).

#### <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3kjPErkJ9W5XjY27oH%2F-M3kmu7-KY9x63rZk3Qz%2Fenlarge_48.png?alt=media&#x26;token=e2114a07-6532-4489-946d-74968f6a4389" alt="" data-size="line"> Scale type (Only in ImageView)

| Type           | Explanation (Source: abhiandroid.com)                                            |
| -------------- | -------------------------------------------------------------------------------- |
| FIT\_XY        | Fill the image from x and y coordinates of the container                         |
| FIT\_START     | Scale the image from start of the container                                      |
| FIT\_CENTER    | Scale the image from center                                                      |
| FIT\_END       | Scale the image from the end of the container                                    |
| CENTER         | Center the image but doesn’t scale the image                                     |
| CENTER\_CROP   | Scale the image uniformly                                                        |
| CENTER\_INSIDE | Center the image inside the container, rather than making the edge match exactly |

![Examples (Pic. 9)](https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3kjPErkJ9W5XjY27oH%2F-M3kppCi4HezeGj_-NTJ%2Fscaletype.jpg?alt=media\&token=669b98e7-ace7-47a8-802f-399fc0bfbb83)

#### <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3EqBZN970VxJa0Mp01%2F-M3ErjX7oIzO31_wV6Ix%2Fvariation_48.png?alt=media&#x26;token=55695797-fc9a-4741-9334-b771fa42e555" alt="" data-size="line"> Background Resource

Background resource is used for setting custom background of the widget or layout. **You will need to** [**add image in Image Manager**](https://wiki.sketchub.in/configuration/image) **to set background image.**

#### <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3EmlQGfOfyVOYtEnjw%2F-M3Eq4h4Z4P3xVWj81KZ%2Fcolor_palette_48.png?alt=media&#x26;token=95fcd8ab-a134-4f5b-8718-23e84cd59f3d" alt="" data-size="line"> **Background Color**

Used to set background color of the widget.

#### <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3eTtsvKBf1yUqeMeun%2F-M3eV0X-XieYq-5_3uaE%2Flight_on_48.png?alt=media&#x26;token=922aff9a-f4a8-480c-a6e3-34a984861f3a" alt="" data-size="line"> Enabled

| Values | Explanation                                                                                           |
| ------ | ----------------------------------------------------------------------------------------------------- |
| ON     | Enables the widget, allowing codes and users to manipulate it.                                        |
| OFF    | Disables the widget, hence nobody will have access, even your codes (until you don't enable it back). |

#### <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3eTtsvKBf1yUqeMeun%2F-M3eWTf7IE2oYCllKFdP%2Fevent_animation_repeat_48dp.png?alt=media&#x26;token=ef372d41-3839-4695-ab1b-3af652956b57" alt="" data-size="line"> Rotate

It rotates the widget with specific angle you give.

#### <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3kejTOB-P-w6lG25WI%2F-M3kfpHb5UM6NouNljH0%2Fswipe_right_48.png?alt=media&#x26;token=04c45839-81cf-47f2-9cb3-b7c79fc67c8f" alt="" data-size="line"> Translation X and Y

This is rarely used but important property, it moves the widget from its original position. For example, in this image (Pic.8), both widgets have -45 Y translation, which moves them horizontally.

![Example (Pic.8)](https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3kejTOB-P-w6lG25WI%2F-M3kizID_-DxDOhd3U9p%2Ftranslationxy.jpg?alt=media\&token=11d5bd20-4612-4c41-b416-c6d37cb6e538)

#### <img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-M3kjPErkJ9W5XjY27oH%2F-M3kjYDYu9m-JrEBVbGl%2Fresize_48.png?alt=media&#x26;token=b035d5fa-dba7-47a3-8625-1953083e7807" alt="" data-size="line"> scaleX and scaleY

Scale is used to resize widgets; it also resizes the contents in it (in linear layouts and scroll view). It is not used usually in Sketchware because it stretches everything and make the UI worse if not used properly.
