Giter Club home page Giter Club logo

criminalintent2's Introduction

CriminalIntent2

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.

==

Index

==

Styles, themes, and theme attributes

Style

  • An XML resource that contains attributes that describes how a widget should look and behave.

Creating our own styles

  • Add them to a style file in res/values/
  • Refer to them in layouts like @style/my_own_style

Theme

  • A collection of styles
  • A style resource whose attributes point to other stye resources
  • Android provides platform themes that our app can use.

Theme attribute reference

  • We can apply to a widget a style from the app's theme by using theme attribute reference.
  • E.g. style="?android:listSeparatorTextViewStyle"

==

Screen pixel densities and dp and sp

  • In practice, sp and dp are used almost exclusively
  • Android will translate these values into pixels at runtime

dp (density-independent pixel)

  • 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

sp (scale-independent pixel)

  • Density-independent pixels that also take into account the user's font size preference.
  • Almost always used to set display text size

==

Layout parameters vs widget parameters

Layout parameters

  • Attributes whose names begins with layout
  • directions to the widget's parent
  • E.g. margin - android:layout_marginLeft

widget parameters

  • Attributes whose names does not begin with layout
  • directions to the widget
  • E.g. padding - android:padding

==

Shortcut keys (OS X)

  • importing class - option + return
  • rotating the emulator - fn+contol+F12

==

Declaring an activity in the manifest

  • Declare all the activities in the manifest
  • Specify the launcher activity

==

Toast

String msg = "clicked";
Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();

==

Don't forget to add an activity to the manifest

  • When creating a new activity, add it to the manifest so that the OS can start it.

==

Creating an icon as a local resource using Android Asset Studio

  1. right-click on the drawable directory
  2. select New -> Image Assset
  • mdpi, hdpi, xhdpi, xxhdpi icons will be automatically created
  • Reference the icon using @drawable/ic_name in the xml file

criminalintent2's People

Contributors

mnishiguchi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.