This repo is for me to practice Android Programming, along with the tutorial book Android Programming(2nd ed.) by Bill Phillips, Chris Stewart, Brian Hardy and Kristin Marsicano. All the credit goes to these guys from Big Nerd Ranch. It's an awesome book.
==
- DateFormat
- Dependencies - Adding dependencies in Android Studio
- Dialog
- Fragment
- Parameters - Layout parameters vs widget parameters
- Pixels - Screen pixel densities and dp and sp
- RecyclerView
- Shortcut keys
- Singletons
- Styles, themes, and theme attributes
- ViewPager
==
- An XML resource that contains attributes that describes how a widget should look and behave.
- Add them to a style file in
res/values/
- Refer to them in layouts like
@style/my_own_style
- A collection of styles
- A style resource whose attributes point to other stye resources
- Android provides platform themes that our app can use.
- We can apply to a widget a style from the app's theme by using theme attribute reference.
- E.g.
style="?android:listSeparatorTextViewStyle"
==
- In practice,
sp
anddp
are used almost exclusively - Android will translate these values into pixels at runtime
- Typially used for margins, padding, or anything else for which you would otherwisespecify size with a pixel value
- Always 1dp = 1/160 inches on a device's screen, regardless of screen density
- Density-independent pixels that also take into account the user's font size preference.
- Almost always used to set display text size
==
- Attributes whose names begins with layout
- directions to the widget's parent
- E.g. margin -
android:layout_marginLeft
- Attributes whose names does not begin with layout
- directions to the widget
- E.g. padding -
android:padding
==
- importing class -
option
+return
- rotating the emulator -
fn
+contol
+F12
==
- Declare all the activities in the manifest
- Specify the launcher activity
==
String msg = "clicked";
Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
==
- When creating a new activity, add it to the manifest so that the OS can start it.
==
- right-click on the drawable directory
- select New -> Image Assset
- mdpi, hdpi, xhdpi, xxhdpi icons will be automatically created
- Reference the icon using
@drawable/ic_name
in the xml file