Today, I will be sharing some useful tips that I wish I knew when I started using Sketchware. These tips will help you work faster and simplify the way you do tasks.
COPYING A LAYOUT
You've built a beautiful layout or someone shared a project with you and you want to replicate the layout on another activity. Instead of having to recreate it, you can highlight the layout that you want to copy and then click the save button.
Phones come in various models and device sizes. This means that your app will not look the same on all screens. An easy way to avoid any problems that this might solve is to use the weight property instead of a fixed width and height. A weight of 1 takes up the available space on the screen. Think of it as a ratio... if weight is 1, then it takes up 1 or the entire space in that layout or screen. If the weight is 2, it means that our ratio is 2:1 meaning 2 items can fit on one screen. Weight sum is the total weight that a layout can accommodate. So a weight of 3 means it will take up 3 items with a weight of 1 each.
NAME YOUR LAYOUTS AND WIDGETS
This might not be necessary when using a small number of widgets on an activity but as you build more complex logic, it is easier to identify widgets by their names in your logic. For example if I have edittext1, edittext2, edittext3 and edittext4, it's wise to rename them "username", "email", "password" and "confirm_password". This let's you know which item you are using. It also saves you from mismatches and it simplifies troubleshooting. Click on any item that you want to rename... once the properties menu appears, click "id" and give it a new name.
NB- Unless its convenient, avoid giving your widgets names like "value1", "value2." This might cause challenges when you now have to compile your data on one activity and you now have 6 items from different activity with the name "value1". Rather use names like "purchases", "weekly_purchases" and "sales"
CHOOSE A STYLE AND BE CONSISTENT
When naming your widgets and setting up your keys, you should come up with a style that works for you and be consistent. The listview keys and other items are case sensitive... so a minor difference such as capitalization of one key and not the other could cause you unnecessary headaches. So if you're going to use small letters, be consistent with it. If you're going to use underscore to separate characters, be consistent with it. You might remember what you're doing now, but after some months you probably won't.
BE WARY OF AUTOFILL
The autofill feature is very helpful in filling in information but I've noticed that at times it adds a space after the character sequence. The system views this blank space as an additional character. The challenge is that it's hard to identify the additional blank space especially if it's at the end of the character sequence. So you might get users saying I'm trying to login but I can't. In some instances it's because they used autofill and the blank space makes the sytem recognize that email is badly formatted.
I hope you found these tips very helpful. Here's to wishing you all the best as you continue to build that amazing app of yours.
COPYING A LAYOUT
You've built a beautiful layout or someone shared a project with you and you want to replicate the layout on another activity. Instead of having to recreate it, you can highlight the layout that you want to copy and then click the save button.
After you save a layout it will appear in your views just under the shared views icon
You can then drag it from the list and use it again on another activity.
SAVE BLOCKS TO COLLECTIONS
After creating a complex or long sequence of blocks, instead of having to recreate them, you can copy them to your collections. These will be available in your collections and you can easily access and reuse them from there.
SAVE BLOCKS TO COLLECTIONS
After creating a complex or long sequence of blocks, instead of having to recreate them, you can copy them to your collections. These will be available in your collections and you can easily access and reuse them from there.
NB- You still have to recreate variables and other components that you want to reuse on the new activity. These will not be imported unless they already exist. For example if I have a list string "countries" that I want to reuse on another page. I simply have to create a new list string countries then I can import my blocks.
USE MOREBLOCKS
USE MOREBLOCKS
Moreblocks are meant to make it easier to do tasks and to keep your logic neat. As you add more features to your app, its logic will also become more complex. So instead of placing all your blocks in onCreate, you can use moreblocks. Say I want to check time, show welcome message, set text data and so on... I will only have the moreblocks in onCreate and then I know exactly where to go if I want to adjust the logic for checking time.
SAVE MOREBLOCKS TO COLLECTIONS
SAVE MOREBLOCKS TO COLLECTIONS
Say you have a moreblock that changes the font of all widgets in your app, instead of having to recreate it on each activity, you can save it to your collections and then import it from collections whenever you need it. In the screen above, the arrows sho how to add to collections. At the top of the screen, just under events, we have "Import from Collections" this is where your Moreblock will be saved.
USE WEIGHT PROPERTY FOR FLEXIBLE LAYOUTS
USE WEIGHT PROPERTY FOR FLEXIBLE LAYOUTS
Phones come in various models and device sizes. This means that your app will not look the same on all screens. An easy way to avoid any problems that this might solve is to use the weight property instead of a fixed width and height. A weight of 1 takes up the available space on the screen. Think of it as a ratio... if weight is 1, then it takes up 1 or the entire space in that layout or screen. If the weight is 2, it means that our ratio is 2:1 meaning 2 items can fit on one screen. Weight sum is the total weight that a layout can accommodate. So a weight of 3 means it will take up 3 items with a weight of 1 each.
NAME YOUR LAYOUTS AND WIDGETS
This might not be necessary when using a small number of widgets on an activity but as you build more complex logic, it is easier to identify widgets by their names in your logic. For example if I have edittext1, edittext2, edittext3 and edittext4, it's wise to rename them "username", "email", "password" and "confirm_password". This let's you know which item you are using. It also saves you from mismatches and it simplifies troubleshooting. Click on any item that you want to rename... once the properties menu appears, click "id" and give it a new name.
NB- Unless its convenient, avoid giving your widgets names like "value1", "value2." This might cause challenges when you now have to compile your data on one activity and you now have 6 items from different activity with the name "value1". Rather use names like "purchases", "weekly_purchases" and "sales"
CHOOSE A STYLE AND BE CONSISTENT
When naming your widgets and setting up your keys, you should come up with a style that works for you and be consistent. The listview keys and other items are case sensitive... so a minor difference such as capitalization of one key and not the other could cause you unnecessary headaches. So if you're going to use small letters, be consistent with it. If you're going to use underscore to separate characters, be consistent with it. You might remember what you're doing now, but after some months you probably won't.
BE WARY OF AUTOFILL
The autofill feature is very helpful in filling in information but I've noticed that at times it adds a space after the character sequence. The system views this blank space as an additional character. The challenge is that it's hard to identify the additional blank space especially if it's at the end of the character sequence. So you might get users saying I'm trying to login but I can't. In some instances it's because they used autofill and the blank space makes the sytem recognize that email is badly formatted.
I hope you found these tips very helpful. Here's to wishing you all the best as you continue to build that amazing app of yours.
Comments