Difference in performance using linear layout or constraint layout? - android-linearlayout

I have worked on 2 apps and for me personally linear layouts are better as i can use weight sums and nested linear layouts which can set better layouts on different devices.
On applying weight sum i do not have worry about some differences like changing sizes of layouts in xxhdpi, hdpi and stuff like that.On minor occasions i do changes in sizes of text boxes in hdpi , xhdpi.. but the point is they give better result and i have applied them where constraint layout were not fit to use.
The issue i hear about that using linear layouts you can have performance issues so applying constraint layouts are better.
So as experienced developers which ways are better when setting a layout of activity and what do you use in making apps?

all depends upon your requirements, constraint layout is enhanced form of relative layout. in most cases constraint layout used to design responsive layouts but its code can be complex. on the other hand linear layout is easy to use. performance differences is hard to notice in most cases. for more information you can refer to this article
https://android.jlelse.eu/constraint-layout-performance-870e5f238100

Related

css grids layout - mobile first approach

Why do we need to define the grid for mobile?
What is the advantage of doing so?
Check this example: common layouts with ccs grids on MDN
So, we could have the same results for mobile without defining a grid, just defining the grid at the first breakpoint would do the job.
You're correct for the most part. With the example in that tutorial, there is no difference if you declare the grid at the first breakpoint. The only differences are semantic.
Some of the benefits:
Consistency and clarity:
Your code will be more consistent and easier to intuit what is going on if the same layout method is used across all your breakpoints. Good css is easy to read, even for people who are not familiar with the project, who are not familiar with your coding style. If you intend to use grid layout, it should be consistent and used across the board.
Complexity of layout:
The example doesn't require grid layout for mobile, but that doesn't mean that will always be the case. As you iterate over the design, you may need to add more complexity later. If the structure is in place from the get-go, the refactoring process becomes easier.
Still, there is an argument to be made for only including code that is absolutely necessary to implement the correct layout. It's really down to personal preference whether you include it or not.

What unit of width should I use (px or % or em) for columns in a grid/ table [number of columns differ for different users]-CSS

I have a table that has 10 columns and for an advanced user, there would be 20 columns. So the column width would change based on the user. I was using 'px' to specify the size of each column. Is 'px' best way of doing it? The programmer before me used '%' for another grid (unlike mine, it had fixed number of columns).
This application would run on IE8/ IE9.
Intent of question: Is 'px' best way to specify width in situations where the column numbers might change frequently.
To be honest you are overcomplicating matters for yourself. Its true that vanilla frameworks are bloated but you can cut out what you don't need and use the rest.
Por ejemplo:
Foundation 4 Grid Framework
http://foundation.zurb.com/develop/download-f4.html
Patch for IE8+
https://gist.github.com/hatefulcrawdad/5068210
To answer you original question however, there is no right answer. You can have a column framework using pixel widths using the older methods of floating and clearing
You could also have a percentage based framework which uses a pixel based container to simulate pixel widths.
In Short
I recommend you study the CSS on grid systems such as Bootstrap, 960Grid and Foundation (my personal recommendation) and how they work for you.
Then develop your own based off the system you prefer. You'll also gain a better understanding of Grid System development.

Grid layout - why should I use it, and should I use a framework like Bootstrap or Foundation?

I had experience with Twitter Bootstrap and Foundation, and I personally think the only thing I want to use is their grid system. Other features are just bloated.
So I read about the prospect of a grid layout. All of the articles I found are oriented toward an 'artistic' explanation (golden ratio ect). I am a coder at heart, I need a clear & logical reason to use a grid layout (for example: 'columns can be easily stacked on top of each other on mobile screen, and expand horizontally on larger screens'). Can someone give me the pros and cons of applying a grid system to my website? Personally do you think using a grid system is good?
If the answer is yes, should I use a premade grid system like from Twitter Bootstrap/Foundation or just make one for my own? All of the other features are unnecessary for me an irrelevant to my problem.
Thanks! :D
I agree with #kunalbhat that this might not be the best area to ask this but since you did I will try to answer it.
The grids are designed allow for speed and adaptability. Speed in multiple senses. The first part of the speed is the speed of writing the code. You can easily get the layout you want when you are using the grid system and everything aligns correctly. You don't have to remember your tables and columns and col-spans, etc.
The second speed is modifying your code. Inevitably you will need to go back and make changes, with a grid this is easily to do. Changing a col-md-7 to a col-md-6 easily makes a little tweak in the layout of your page that can easily be tracked and performed.
You mentioned responsive design, both Bootstrap and Foundation have responsive grids. The grids will snap to different sizes based on the viewport size. However you have control as well. For example if you want something to take 1/12th the screen in desktop, 1/4th on a tablet, and 100% on a phone that is easily done with Bootstrap and Foundation, both have grid classes that target specific viewports.
The also provide visibility classes based on those viewports.
For the "bloated" part that is easily solved. Using SCSS you can easily only import portions of a library. For example for one project I was on I only imported the Grid and it was considerably smaller.
I happen to think that this is a SO question, simply because of one of the main cons of CSS grid systems: semantic.
I think semantic is important for a web developer and having a class named col-md-7 is not the most semantic thing to do.
But I like grids, because they are easy and quick to use, so I started to use LESS. Because it allows me to use variables and functions(mixins) in CSS, I can build my own grid system on my CSS rather then on my HTLM.
You can start on Frameless and customize your own 'classes'.

CSS grid systems offsets columns etc

I know probably most of you know all of these stuff but still maybe out there are people like me who are just starting to learn these stuff about grids in css. and maybe these questions will help them too.
What are grid systems ?
how to calculate a grid system in pixels and percentages ?
What are offsets? How to calculate offsets ?
Is it better to use a grid system ?
As you have probably already encountered there are so many different grids and css frameworks it can be a little confusing, so I will try my best to help.
Grids are nothing more than an area of screen broken down into segments. Most grids are typically split into groups of 12 (or multiples of twelve). So with a container 960px wide and having 12 groups (which I will now call columns) each column is 80px wide.
Calculating grids can be complex and when combined with adding gutters, offsets, margins, nesting, containers, etc. your css can get rather messy pretty quickly.
There are a number of grid based css frameworks out there with the two most popular being Bootstrap by Twitter and the Foundation by Zurb. I believe that these two have grown in popularity over Blueprint CSS and 960 grid + others as they offer a wide range of plugins as well as layers of scaffolding to help building really nice looking responsive websites.
Hope this helps.

Grid CSS layouts. Tell me the reasons to not use

Since I new with CSS, I just started to work with CSS Grid system. I would like to know if are there any technical issues in use CSS grids? I mean, which are the reasons for you to not use grid?
Thanks
Flexibility
Once you start using the grid, you are stuck with it. Any other issues you might wind up finding you will have to conform to.
In my opinion (and every other designer I've talked to) it is far easier to simply define your own columns and default sizes as classes and apply them as-needed. A custom grid if you will. Then changing the styling is as easy as changing a line or two of CSS, instead of either re-generating the grid system or redesigning the site and sacrificing in order to use the grid.
I'm a fan resets and some minor love from Blueprint (especially the Typography), but that's about it.
I've just started using object oriented CSS (OOCSS). I'm really enjoying it because it provides a very basic and minimalistic grid system. It allows you to create relative sized grids by dividing an element into halves, thirds, fourths, or fifths. The divided elements are infinitely nestable.
OOCSS is more of a philosophy than a framework. It's all about how you extend a very basic foundation.
Check out these links:
http://oocss.org/
http://developer.yahoo.net/blogs/theater/archives/2009/03/website_and_webapp_performance.html
http://www.youtube.com/watch?v=j6sAm7CLoCQ
The only real reason is that they can lead to bloated markup, sometimes you have to do some serious nesting depending on the layout and desired effects+flexibilty.
They also lead to excessive class name lists on elements. However, you can avoid this at least if you move the CSS to semantic classes/ids before deploying... but thats can be alot of extra work. Blueprint is the excpetion here because it has acommand line tool to allow you to apply the rules from its framework classes to semantic selectors.
Overall i generally use them because its alot easier to teach a designer how to use a grid template. That why im not do alot of production art tasks when i go to slice things down. It jsut makes the whole process smoother IMO.
If your site has a column layout AND repeatable design patterns throughout the site... then there aren't any reasons not to include a grid. A grid adds: organization, proportion and alignment to your page. So why not keep that consistent? There is no reason.
Just don't Overuse A Grid
Some people say a grid is inflexible? That's not totally true - you can use it where you need it. You can always remove it or adjust. Just don't overuse it.
It depends on the grid system. Most grids have a fixed amount of columns, which restrict you in how you create your layout. For example, they don't allow you to combine 30%/30%/40%, 50%/50%, 25%/75% and whatever other combinations you can think of.
Some grid systems also don't allow nesting. That means you can't use a grid element as a grid for child elements in those grid systems, which makes it a lot more difficult for many layouts to be coded to HTML.
Also, some grid systems use techniques that don't work in older browsers. Before you use a grid system, you should always make sure it supports the browsers you need to support with your project.
There are frameworks out there without such restrictions, though. Cascade Framework, in fact, has a grid system far more flexible than that of any other framework out there and works fine in both IE6-8 and modern browsers alike.

Resources