When you’re creating complex layouts, you may find yourself adding a lot of View-Groups and Views. But making your view hierarchy tree taller will also make it slower.
Creating optimized layouts is fundamental to building an application that runs fast and is responsive to the user.
In this hack, you’ll learn how to use the <include /> tag in your XML to avoid replication, and how to use the ViewStub class to lazy load views.
Friday, July 19, 2013
Centering views using weights Android v1.6+
At an Android talk I gave to a group of developers, when I was explaining how to create a view using an XML file, someone asked, “What should I write if I want a button to be centered and 50% of its parent width?” At first I didn’t understand what he was asking, but after he drew it on the board, I understood. His idea is shown in figures 1.1 and 1.2.
What is Android?
Android is an open source operating system based on Linux. In the beginning, it was just for cell phones, but now it works on tablets, TVs, computers, and even car stereos. It has been gaining a lot of momentum in the mobile scene and is now used in more than 50% of mobile devices.
Subscribe to:
Posts (Atom)
