A Human Touch

A Piece of Advice before we start..... 

I know that people don't like advices, but still its a free one for all those who want to receive may take it, while others may move on.

I'm not a voracious reader, but once while I was going through a book I came across a sentence that says 'A good repairmen is the one who can understand the feelings of the engine'. It simply means that, just by hearing the sound of  the engine the repair-person comes to know about the problem that the engine has. Thereafter he concentrates on only the crucial aspect of the engine that requires care. This is exactly the place where 'The Human Touch' lies.

I thought of applying the same idea with the programming stuff, and found out that It really worked. The basic fundamental quality that I think a good programmer should have is the 'Ability to Communicate' with the program snippets. The programmer should be able to understand what the code has to say. Its definitely a two-way communication. Unless and until the programmer asks questions to the program how can he/she expect to receive an answer. Once the gap between the programmer and the program is bridged with the help of this human aspect called Feelings, the code automatically starts understanding the programmer and responds to whatever the programmer questions.

So, keep speaking to the code that you are writing.
Good Luck...

Nov 16, 2011

LinearLayout Examples

As we are done with our first 'Hello World' program lets move a bit further and talk about LinearLayout in Android.
There are two methods for defining the position of components(Button, EditText, ....) in Android
Method 1: By directly embedding the components into the java code as we did in java.
Method 2: By using the xml file to define the layout.

The 2nd method defined above is mostly used. This method separates the designing part with the coding one. So code management becomes easier. Hence, we'll be discussing much about the xml layout files henceforth.

Note : A most important thing that i should have told earlier. Do not in any way try to play with the R.java file generated in the project. This is a self generated file and represents all the resources in the project.

Coming back, as the name indicates all the components contained in the <Linearlayout>....</Linearlayout> would be arranged in an linear fashion.

Sample 1: android:orientation="vertical" 
Output:

Sample 2: android:orientation="horizontal"
Output:

Sample 3: android:gravity="center"
Output:

Sample 4: android:gravity="right"
Output:

Sample 5: Layout within Layout
Output:






No comments:

Post a Comment