Android Development for Beginners - Udacity - Lesson 1A

***UDACITY - ANDROID DEVELOPMENT FOR BEGINNERS***
*****************************************************************

***LESSON 1A: BUILDING LAYOUTS***

1.There are three types of view basically:

    Text View
    Image View
    Button View.

2.XML stands for "Extensible Markup Language". It is a notation for writing information as a hierachy or family tree. The family tree structure makes it ideal for describing the layout of the screen of an Android App, which is composed of rectangular areas called VIEWS.

3.The layout always contains of one small big view, which may contain smaller ones, which may in turn contain even smaller ones.

4.TIL: CAMEL CASE Fomrat: The text writing format in which the two words are joined together and the first letter of each word is capitalised.

5.XML SYNTAX:

    Start with open angle bracket, followed by the VIEW name in camel case. It is followed by the list of attributes, one per line. Forward slah and closing bracket.

    Parent and Child XML elements. Child element is contained in the parent element.

    ATTRIBUTES are te]he characteristics that determine the behaviour or appearence of the view on the android phone.

    ATTRIBUTE NAME on the left-hand side and ATTRIBUTE VALUE on the right hand-side. The values are put in the quotation marks.

    TextView has default values for all of its attributes, and hence it is not necessary to set all of them, only those attributes which are to be changed are set.

6.DP stands for "Density Independent Pixel". The pixel size is independent of the resolution of the screen.

7.All touch targets should be at least 48 dp tall and wide.

8.Instead of hard coding the text width value, we can use in "android:layout_width" attribute, "wrap_content" as value. The width would fit the text size.
   
    Similarily, for the height also.

9."android:textSize" has the measure "sp". It is called "scaled independent pixels". It is just used for fonts.

10. TIL - Google site for material design -  http://www.google.com/design/spec/style/typography.html#typography-styles

11. **FROM ANDROID DEVELOPERS GOOGLE+ PAGE:

***To use a standard text size (and color), instead of setting the TextView's android:textSize directly, set the android:textAppearance to a predefined theme attribute [1] such as android:textAppearanceLarge:

<TextView
    …
    android:textAppearance="?android:textAppearanceLarge" />
As of API 19 (KitKat):
• ?android:textAppearanceSmall is currently 14sp
• ?android:textAppearanceMedium is currently 18sp
• ?android:textAppearanceLarge is currently 22sp

These default sizes and concepts are also documented in the "Typographic scale" section of the Android Design guide [2].

Note that setting the text appearance will also affect the default values for text color attributes such as android:textColor and android:textColorHint. You can always override the default values by providing those attributes directly on the TextView element:

<TextView
    ...
    android:textAppearance="?android:textAppearanceLarge"
    android:textColor="@color/my_own_color"
    android:textColorLink="@color/my_own_link_color"/>***

12. "android:background" can be colourised directly by using the Hex Code of the supported colours in android. similarily for "android:textColor" attribute.

13. ImageView:

"android:src=@drawable/cake"

    @ means we are referencing to a resource in android app.
    "drawable" is the type of resource.
    the file extension is not used here.

14. "android:scaleType" tells how to scale the image in the app. One of its value is "center" and "centerCrop" which crops and fits the image to the size of the view.Original aspect ratio is maintained.

15. "android:textStyle" sets the style bold, italics, bolditalic for the text.

Comments

Popular posts from this blog

Coursera - CS 101 - Completed