{"id":836,"date":"2015-08-17T21:23:23","date_gmt":"2015-08-18T04:23:23","guid":{"rendered":"http:\/\/appinventor.pevest.com\/?p=836"},"modified":"2015-08-17T21:23:23","modified_gmt":"2015-08-18T04:23:23","slug":"example-of-the-new-app-inventor-responsive-design-feature","status":"publish","type":"post","link":"https:\/\/coldstreams.com\/appinventor\/2015\/08\/17\/example-of-the-new-app-inventor-responsive-design-feature\/","title":{"rendered":"Example of the new App Inventor &#8220;Responsive Design&#8221; Feature"},"content":{"rendered":"<p>MIT App Inventor introduced today their new &#8220;responsive design&#8221; features so that apps can work &#8220;better&#8221; on different sized screens. Using these new features, you can create a single app that should run on both a smart phone and a tablet, yet still display proportional user interface controls. Prior to this, your nicely designed smart phone app could end up having very small buttons or text boxes when run on a tablet; now, these components will resize as needed.<\/p>\n<p>The name &#8220;responsive&#8221; comes from the ability of the app to &#8220;respond&#8221; to the size of the device and to change the size of controls so they maintain a similar size on each device. <em>The terminology &#8220;responsive web design&#8221; also refers to web sites that are designed to work with different sized mobile device screens &#8211; here is <a href=\"http:\/\/www.web3solution.com\/what-we-learned-about-responsive-design-rwd-by-analyzing-362-projects\/\">a link to a great article about responsive web site design<\/a>, passed to us by reader David &#8211; thanks!<\/em><\/p>\n<p><!--more--><\/p>\n<h2>How This Works<\/h2>\n<p>Here is a screen with 2 buttons and 1 text box. Each component has its vertical and horizontal width set to &#8220;Automatic&#8221;. This is a screen shot from an app running on a Nexus 7 tablet:<\/p>\n<p><a href=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/08\/Screenshot_2015-08-17-20-42-18.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-837 aligncenter\" src=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/08\/Screenshot_2015-08-17-20-42-18-188x300.png\" alt=\"Screenshot_2015-08-17-20-42-18\" width=\"188\" height=\"300\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>We can change the button properties to specify a width in percent, rather than automatic or a &#8220;Fixed&#8221; (one size only). Here, button 1 is changed to a 30% width and button 2 is changed to a 50% width &#8211; note how the 50% sized button uses up half the screen width:<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/08\/Screenshot_2015-08-17-20-41-06.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-839 aligncenter\" src=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/08\/Screenshot_2015-08-17-20-41-06-188x300.png\" alt=\"Screenshot_2015-08-17-20-41-06\" width=\"188\" height=\"300\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Here is the same app running on a Nexus 5 smart phone &#8211; note that the relative sizes of the buttons are the same on the smart phone as they were on the Nexus 7 tablet above:<\/p>\n<p><a href=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/08\/Screenshot_2015-08-17-20-36-06.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-838 aligncenter\" src=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/08\/Screenshot_2015-08-17-20-36-06-169x300.png\" alt=\"Screenshot_2015-08-17-20-36-06\" width=\"169\" height=\"300\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Both the height and width may be set as a percentage &#8211; in this example, the width of button 1 has been set to 75% and the height has been set to 15%, creating a taller button than the normal button size:<\/p>\n<p><a href=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/08\/Screenshot_2015-08-17-20-44-06.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-840 aligncenter\" src=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/08\/Screenshot_2015-08-17-20-44-06-188x300.png\" alt=\"Screenshot_2015-08-17-20-44-06\" width=\"188\" height=\"300\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>Setting the Height and Width Properties<\/h2>\n<p>Select a control and then refer to the <em>Height<\/em> and <em>Width<\/em> properties for the component. In this example, the width is set to 50% of the parent (which could be a vertical or horizontal layout):<\/p>\n<p><a href=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/08\/RDProperties.png\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-841 aligncenter\" src=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/08\/RDProperties.png\" alt=\"RDProperties\" width=\"189\" height=\"212\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>These properties may also be set programmatically. For example, this blocks code changes the size of a button while the app is running!<\/p>\n<p><a href=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/08\/BlocksCode.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-842 aligncenter\" src=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/08\/BlocksCode-300x85.png\" alt=\"BlocksCode\" width=\"300\" height=\"85\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Which produces this funny result when button 2 is pressed:<\/p>\n<p><a href=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/08\/Screenshot_2015-08-17-20-57-48.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-843 aligncenter\" src=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/08\/Screenshot_2015-08-17-20-57-48-188x300.png\" alt=\"Screenshot_2015-08-17-20-57-48\" width=\"188\" height=\"300\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>You could probably make a game based on control sizes \ud83d\ude42 Controls could grow bigger and smaller as you attempt to tap on each button!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MIT App Inventor introduced today their new &#8220;responsive design&#8221; features so that apps can work &#8220;better&#8221; on different sized screens. Using these new features, you can create a single app that should run on both a smart phone and a tablet, yet still display proportional user interface controls. Prior to this, your nicely designed smart &hellip; <a href=\"https:\/\/coldstreams.com\/appinventor\/2015\/08\/17\/example-of-the-new-app-inventor-responsive-design-feature\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Example of the new App Inventor &#8220;Responsive Design&#8221; Feature<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,10],"tags":[21,22,28,31,63,65,151,157,176],"class_list":["post-836","post","type-post","status-publish","format-standard","hentry","category-components","category-programming-method","tag-app","tag-app-inventor","tag-appinventor","tag-apps","tag-components","tag-controls","tag-programming","tag-responsive-design","tag-software"],"_links":{"self":[{"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/posts\/836","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/comments?post=836"}],"version-history":[{"count":0,"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/posts\/836\/revisions"}],"wp:attachment":[{"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/media?parent=836"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/categories?post=836"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/tags?post=836"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}