路徑:
bin/xxx.apk
執行App後,才會產生新的apk
2013年9月17日 星期二
2013年8月19日 星期一
App Icon image & Icon title
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cookbook.simple_activity"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name=".SimpleActivity"
android:label="@string/app_name">
2013年8月18日 星期日
2013年8月15日 星期四
2013年8月14日 星期三
Model View Controller
In Android, a controller is typically a subclass of Activity, Fragment, or Service.
設定listener
ex
JAVA:
mTrueButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "Correct", Toast.LENGTH_SHORT).show();
}
});
mFalseButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "Wrong", Toast.LENGTH_SHORT).show();
}
});
XML:
<Button
android:id="@+id/editPlanWorkButton"
android:layout_width="0dp"
android:layout_height="44dp"
android:textColor="#000000"
android:background="@drawable/roundcornerforplanworkbutton"
android:layout_alignParentRight="true"
android:text="靜態活動(大部份時間都坐著)"
android:layout_toRightOf="@id/editPlanWorkTextView"
android:layout_alignBottom="@id/editPlanWorkTextView"
android:layout_marginLeft="12dp"
android:textSize="14sp"
android:onClick="editPlanWorkButtonClick"
/>
Resource
A resource is a piece of your application that is not code – things like image files, audio files, and XML files.
To access a resource in code, you use its resource ID
resource ID is int
查詢Resource ID
gen/R.java
android:id="@+id/example"
The at symbol (@) signifies that you’re referring to a resource rather than providing a literal value. The plus (+) indicates that you are creating a new resource reference; without it, you’re referring to an existing resource reference. Then comes id, defining what type of resource it is. Finally, you have the name of the resource
directory res is for resource
Resource Qualifiers
By using resource “qualifiers,” you can let Android take care of this for you.
A qualifier is a portion of a directory’s name that marks its contents as being used for a specific situation
ex:
ldpi
mdpi
hdpi
resource folder name
animator: Property animations defined in XML.
anim: View animations defined in XML.
color: State lists of colors defined in XML. State lists are covered later in this chapter.
drawable: Drawable assets that can be defined in XML or image files (PNG, GIF, or JPG).
layout: Layouts defined in XML.
menu: Menus such as the action bar menu defined in XML.
raw: Any raw files such as audio files and custom bytecode.
values: Various simple values defined in XML, such as strings, floats, and integer colors.
xml: Any XML files you wish to read at runtime.
other resources:
Strings
Arrays
Colors
Dimensions
Animations
建立新專案
1. File -> New -> Project
2. Android -> Android Application Project
預設Application Name欄位會連帶影響Project Name和Package Name欄位
4. 取消Create custom launcher icon的勾選
5. 設定建立Blank Activity
6. 設定Activity和Layout的名稱
訂閱:
文章 (Atom)

















