Do "Java & Android" Dream of Electric Degu?
http://w.atwiki.jp/andro_degu/
Do "Java & Android" Dream of Electric Degu?
ja
2011-02-16T22:49:10+09:00
1297864150
-
Const
https://w.atwiki.jp/andro_degu/pages/20.html
#html2(){{{
<table border=1 bgcolor="#808080" cellspacing=1 cellpadding=0>
<tr><td>あああ</td>
<td>bbb</td></tr></table>
}}}
2011-02-16T22:49:10+09:00
1297864150
-
TextView設定
https://w.atwiki.jp/andro_degu/pages/19.html
*TextView各種設定に関して
&bold(){&link_anchor(width){幅の設定}}
&bold(){&link_anchor(height){高さの設定}}
&bold(){&link_anchor(moji_color){文字色の設定}}
-&aname(width,option=nolink){幅の設定}
[[リファレンス(XML)>http://developer.android.com/reference/android/widget/TextView.html#attr_android:width]]
[[リファレンス(Method)>http://developer.android.com/reference/android/widget/TextView.html#setWidth(int)]]
|BGCOLOR(#ccc):&bold(){方法}|BGCOLOR(#ccc):&bold(){書式}|BGCOLOR(#ccc):&bold(){説明}|
|XML|android:width|単位は以下の通り&br()・mm(ミリ)&br()・px(ピクセル)&br()・dp(density-independent pixels)&br()・sp(scaled pixels based on preferred font size)&br()・in(inches)&br()記述する場合は単位をつけて記述します。&br()(例)android:height="30px"|
|Method|setWidth( int )|メソッドで記述する場合は単位はピクセルのみの指定になります。|
-&aname(height,option=nolink){高さの設定}
[[リファレンス(XML)>http://developer.android.com/reference/android/widget/TextView.html#attr_android:width]]
[[リファレンス(Method)>http://developer.android.com/reference/android/widget/TextView.html#setWidth(int)]]
|BGCOLOR(#ccc):&bold(){方法}|BGCOLOR(#ccc):&bold(){書式}|BGCOLOR(#ccc):&bold(){説明}|
|XML|android:height|単位は以下の通り&br()・mm(ミリ)&br()・px(ピクセル)&br()・dp(density-independent pixels)&br()・sp(scaled pixels based on preferred font size)&br()・in(inches)&br()記述する場合は単位をつけて記述します。&br()(例)android:height="30px"|
|Method|setMaxHeight( int )|メソッドで記述する場合は単位はピクセルのみの指定になります。|
&bold(){&color(red){※幅と高さに関する注意点}}
&bold(){&color(red){ViewGroup.LayoutParamsのlayout_widthとlayout_heightを指定してサイズを指定している場合はFILL_PARENT指定が優先されるので気をつけること。}}
-&aname(moji_color,option=nolink){文字色の設定}
[[リファレンス(XML)>http://developer.android.com/reference/android/widget/TextView.html#attr_android:textColor]]
[[リファレンス(Method)>http://developer.android.com/reference/android/widget/TextView.html#setWidth(int)]]
[[リファレンス(ColorStateList)>http://developer.android.com/reference/android/content/res/ColorStateList.html]]
|BGCOLOR(#ccc):&bold(){方法}|BGCOLOR(#ccc):&bold(){書式}|BGCOLOR(#ccc):&bold(){説明}|
|XML|android:textColor|色コードで指定する場合:"#rgb", "#argb", "#rrggbb", or "#aarrggbb"&br()リソースの参照は"@[+][package:]type:name" 形式で可能。&br()|
|Method|setTextColor( ColorStateList )|指定の方法はXMLと同様に指定可能。&br()ColorStateListクラスに関してはまだ未確認。|
2010-09-24T16:09:04+09:00
1285312144
-
トップページ
https://w.atwiki.jp/andro_degu/pages/1.html
「&bold(){"Android & Java"は電気デグーの夢をみるか?}」へようこそ
現在編集中
#amazon(487311456X,left)
#amazon(4798027049,left)
#amazon(4798120324,left)
#amazon(4048679562,left)
#amazon(4883377075)
2010-09-21T21:04:23+09:00
1285070663
-
メニュー
https://w.atwiki.jp/andro_degu/pages/2.html
&bold(){メニュー}
#region(close,▼環境構築)
・[[インストール]]
・[[プラグイン設定]]
・[[アップデート]]
#endregion
#region(close,▼Layout Object)
・[[LinearLayout]]
#endregion
#region(close,▼Widgetの基本)
・[[TextView]]
#endregion
&bold(){リンク}
-[[Eclipse日本語版>>http://mergedoc.sourceforge.jp/]]
-[[Android Developer>>http://developer.android.com/index.html/]]
#region(close,技術情報系サイト)
-[[日本Androidの会>>http://android.siprop.org/]]
-[[Android Wiki>>http://wikiwiki.jp/android/]]
-[[ソフトウェア技術ドキュメントを勝手に翻訳>>http://www.techdoctranslator.com/home]]
#endregion
#region(close,入門系サイト)
-[[技術評論社 Android入門>>http://gihyo.jp/dev/serial/01/androidapp]]
-[[JavaDrive Android入門>>http://www.javadrive.jp/android/]]
-[[All About androidプログラミング>>http://wikiwiki.jp/android/]]
-[[CodeZine 速習! Androidアプリケーション開発>>http://codezine.jp/article/corner/338]]
#endregion
//**更新履歴
//#recent(20)
&link_editmenu(text=ここを編集)
カウンター:&counter(total)
今日:&counter(today)
昨日:&counter(yesterday)
2010-09-20T15:58:47+09:00
1284965927
-
TextView
https://w.atwiki.jp/andro_degu/pages/18.html
*TextViewの基本サンプル
XML定義で表示する場合とオンコーディングで表示する場合の2パターンです。
**オンコーディングの場合
***JAVAソース
#highlight(){{
package jp.src_test;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import android.widget.TextView;
public class src_test extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView test_txtview = new TextView(this);-------------------(1)
test_txtview.setText("TextViewのテスト表示");------------------(2)
test_txtview.setBackgroundColor(Color.rgb(255, 33, 66));-------(3)
test_txtview.setTextColor(Color.rgb(0,0,0));-------------------(4)
setContentView(test_txtview, new LayoutParams(--------------(5)
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
}
}
}}
&bold(){(1) TextViewクラスを宣言します。}
&bold(){(2) 表示する文字列を設定します。}
&bold(){(3) 背景色を設定します。}
&bold(){(4) 文字の色を設定します。}
&bold(){(5) TextViewのサイズを指定して表示させます。}
**XML定義の場合
***JAVAソース
#highlight(){{
package jp.src_test;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import android.widget.TextView;
public class src_test extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test_textview);-------(1)
TextView tview=(TextView)findViewById(R.id.txtview);-------(2) }
}
}}
&bold(){(1) "test_textview"という名前で作成されているXMLファイルを呼び出します。}
&bold(){(2) 表示したTextViewのインスタンスを作成します。}
***XMLファイル
#highlight(){{
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/txtview"-------------------(3)
android:layout_width="fill_parent"---------(4)
android:layout_height="wrap_content"---------(5)
android:background="#ff3366"---------(6)
android:textColor="#000000"---------(7)
android:text="TextViewのテスト表示"---------(8)
/>
</LinearLayout>
}}
&bold(){(3) "txtview"という識別名でTextViewに一意になる識別子を与えます。}
&bold(){(4) サイズを指定します。}
&bold(){(5) サイズを指定します。}
&bold(){(6) 背景色を指定します。}
&bold(){(7) 文字色を指定します。}
&bold(){(8) 表示する文字列を設定します。}
&bold(){&color(blue){このサンプルでは"test_textview"というXMLファイルを定義してTextViewオブジェクトには"txtview"という識別子を与えています。 プログラム側は定義名と識別子で画面表示を行います。}}
**実行結果
#image(http://www35.atwiki.jp/andro_degu/pub/widget/TextView01.gif,width=200,title=レイアウト(2),http://www35.atwiki.jp/andro_degu/pub/widget/TextView01.gif,blank)
2010-09-20T15:48:46+09:00
1284965326
-
LinearLayout
https://w.atwiki.jp/andro_degu/pages/16.html
**LinearLayoutサンプル
LinearLayoutクラスをXMLで定義して画面を作ってみました。
JAVAソースはタイトル変更と参照XMLの名称を変更しただけで
***XMLの内容
#highlight(){
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/base001" --------------------------------------(1)
android:orientation="vertical"
android:background="#FFFFFF"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RadioGroup
android:id="@+id/radiogroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/rdio001"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="STAR TREK The Original Series"
/>
<RadioButton
android:id="@+id/rdio002"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="STAR TREK The Next Generation"
/>
<RadioButton
android:id="@+id/rdio003"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="STAR TREK The Deep Space Nine"
/>
<RadioButton
android:id="@+id/rdio004"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="STAR TREK The Voyager"
/>
<RadioButton
android:id="@+id/rdio005"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="STAR TREK Enterprise"
/>
</RadioGroup>
<LinearLayout
android:id="@+id/base002"--------------------------------------(2)
android:orientation="horizontal"
android:layout_width="310px"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#0B2BD7"
>
<CheckBox
android:id="@+id/checkbox001"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TV版"
/>
<CheckBox
android:id="@+id/checkbox002"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="劇場版"
/>
<CheckBox
android:id="@+id/checkbox003"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="その他"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/base003"--------------------------------------(3)
android:orientation="horizontal"
android:layout_width="310px"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#FF0000"
>
<Button
android:id="@+id/button001"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="送信"
/>
<Button
android:id="@+id/button002"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="キャンセル"
/>
</LinearLayout>
</LinearLayout>
}
&bold(){(1) 一番下のLinearLayoutです。ラジオボタンが乗っています。}
&bold(){(2) これが真ん中のLinearLayoutです。チェックボックスが乗っています}
&bold(){(3) これが一番上のLinearLayoutです。ボタンが乗っています。}
画面はLinearLayoutを3層に分けてみました。
(階層別に解りやすい様に色を変えています)
-&bold(){第1階層}
ラジオボタンを配置しています。
ただし、"RadioGroup "クラスを使用して"RadioButton"をグループ化しています。
れをしておかないと"RadioButton"の選択を1つだけにすることができません。
"RadioGroup"クラスを使用しなければ全ての"RadioButton"がチェック可能になります。
-&bold(){第2階層}
チェックボックスを配置しています。
LinearLayoutとしては独立しています。
-&bold(){第3階層}
ボタンを配置しています。
LinearLayoutとしては独立しています。
イメージはこんな感じ。
#image(http://www35.atwiki.jp/andro_degu/pub/layout/LinearLayout01_01.gif,width=400,title=レイアウト(1),http://www35.atwiki.jp/andro_degu/pub/layout/LinearLayout01_01.gif,blank)
**実行結果
#image(http://www35.atwiki.jp/andro_degu/pub/layout/LinearLayout01.gif,width=200,title=レイアウト(2),http://www35.atwiki.jp/andro_degu/pub/layout/LinearLayout01.gif,blank)
2010-09-20T14:05:36+09:00
1284959136
-
アップデート
https://w.atwiki.jp/andro_degu/pages/15.html
***アップデートに関して
このサイトの手順通りに環境を構築していれば、eclipseのメニューバーから
&bold(){[ヘルプ(H)]-[更新の確認]}でアップデートができます。
Androidのパッケージだけをアップデートしたい場合は
AVDマネージャを起動して、&bold(){"Installed Packages"}を選択します。
#image(http://www35.atwiki.jp/andro_degu/pub/install/eclipse13.gif,width=400,title=プラグインの設定(13),http://www35.atwiki.jp/andro_degu/pub/install/eclipse13.gif,blank)
&bold(){Update All...ボタン}を押下します。
これでAndroidのパッケージだけがアップデートできます。
2010-09-20T00:44:04+09:00
1284911044
-
プラグイン設定
https://w.atwiki.jp/andro_degu/pages/14.html
***プラグインとして追加
Android SDKをeclipseのプラグインとして使用する設定を行います。
eclipseを起動して下さい。
起動が完了したらメニューから&bold(){[ヘルプ(H)]-[新規ソフトウェアのインストール]}を選択します。
#image(http://www35.atwiki.jp/andro_degu/pub/install/eclipse01.gif,width=400,title=プラグインの設定(1),http://www35.atwiki.jp/andro_degu/pub/install/eclipse01.gif,blank)
この画面が表示されたら"追加"ボタンを押下します。
#image(http://www35.atwiki.jp/andro_degu/pub/install/eclipse02.gif,width=400,title=プラグインの設定(2),http://www35.atwiki.jp/andro_degu/pub/install/eclipse02.gif,blank)
名前とロケーションを入力して"OK"ボタンを押下します。
&bold(){(1)名前:任意(例:AndroidSDK)}
&bold(){(2)ロケーション:https://dl-ssl.google.com/android/eclipse/}
前の画面+に戻るとダウンロードができる一覧が表示されます。
#image(http://www35.atwiki.jp/andro_degu/pub/install/eclipse03.gif,width=400,title=プラグインの設定(3),http://www35.atwiki.jp/andro_degu/pub/install/eclipse03.gif,blank)
全て選択した後に"次へ(N)"ボタンを押下して下さい。
確認画面が表示されるので"次へ(N)"ボタンを押下して下さい。
#image(http://www35.atwiki.jp/andro_degu/pub/install/eclipse04.gif,width=400,title=プラグインの設定(4),http://www35.atwiki.jp/andro_degu/pub/install/eclipse04.gif,blank)
インストール画面が表示されます。
&bold(){"使用条件の条項に同意します(A)"}を選択すると"完了(F)"ボタンが押せるようになるので押下します。
#image(http://www35.atwiki.jp/andro_degu/pub/install/eclipse05.gif,width=400,title=プラグインの設定(5),http://www35.atwiki.jp/andro_degu/pub/install/eclipse05.gif,blank)
インストールが完了すると下記の画面が表示されるので、再起動します。
#image(http://www35.atwiki.jp/andro_degu/pub/install/eclipse06.gif,width=400,title=プラグインの設定(6),http://www35.atwiki.jp/andro_degu/pub/install/eclipse06.gif,blank)
再起動が完了したらツールバーを確認します。
&bold(){AndroidSDK用のAVDマネージャアイコン}が登録されています。
#image(http://www35.atwiki.jp/andro_degu/pub/install/eclipse07.gif,width=400,title=プラグインの設定(7),http://www35.atwiki.jp/andro_degu/pub/install/eclipse07.gif,blank)
***Android AVDマネージャの設定
Android SDK用ツールの設定を行う。
完了すればeclipseからAndroidアプリケーションの開発とエミュレーターの起動ができるようになります。
eclipseのメニューバーから&bold(){[ウィンドウ(W)]-[設定(P)]}をクリックして設定画面を表示します。
画面が表示されたら左側のメニューからAndroidを選択します。
画面の表示内容が切り替わったら、SDKロケーションの欄に&bold(){&color(red){[SDK_HOME]}}を入力します。
#image(http://www35.atwiki.jp/andro_degu/pub/install/eclipse08.gif,width=400,title=プラグインの設定(8),http://www35.atwiki.jp/andro_degu/pub/install/eclipse08.gif,blank)
ロケーションの設定が済んだらAVDマネージャを起動します。
アイコンをクリックください。
#image(http://www35.atwiki.jp/andro_degu/pub/install/eclipse07.gif,width=400,title=プラグインの設定(7),http://www35.atwiki.jp/andro_degu/pub/install/eclipse07.gif,blank)
AVDマネージャが起動したら左側のメニューからAvailable Packagesを選択します。
画面が切り替わりURLが表示されるので、チェックボックスにチェックを入れます。
#image(http://www35.atwiki.jp/andro_degu/pub/install/eclipse09.gif,width=400,title=プラグインの設定(9),http://www35.atwiki.jp/andro_degu/pub/install/eclipse09.gif,blank)
画面が切り替わって、ダウンロード対象となるファイルの一覧が表示されます。
&bold(){"Install Selected"ボタン}を押下して下さい。
#image(http://www35.atwiki.jp/andro_degu/pub/install/eclipse10.gif,width=400,title=プラグインの設定(10),http://www35.atwiki.jp/andro_degu/pub/install/eclipse10.gif,blank)
確認画面が表示されるので"インストール"ボタンを押下します。
#image(http://www35.atwiki.jp/andro_degu/pub/install/eclipse11.gif,width=400,title=プラグインの設定(11),http://www35.atwiki.jp/andro_degu/pub/install/eclipse11.gif,blank)
インストールが開始されます。
全てインストールされると画面が閉じます。これで環境の構築は完了です。
#image(http://www35.atwiki.jp/andro_degu/pub/install/eclipse12.gif,width=400,title=プラグインの設定(12),http://www35.atwiki.jp/andro_degu/pub/install/eclipse12.gif,blank)
2010-09-20T00:35:17+09:00
1284910517
-
インストール
https://w.atwiki.jp/andro_degu/pages/13.html
**Pleiadesのインストール
***Pleiadesとは
&bold(){&color(blue){Eclipseの日本語対応版}}です。
ここからダウンロード
-[[MergeDoc Project>http://mergedoc.sourceforge.jp/]]
2010年9月23日現在で最新版は「Eclipse 3.6.0 Helios」です。
下位バージョンもダウンロードできるので好みで決めて良いと思います。
Androidでの開発にはJavaは必須なので下記のどちらかを推奨。
-&bold(){Full All in One (JREあり) -Java版}
-&bold(){Full All in One (JREあり) -Ultimate版}
パッケージの内容に関しては対応サイトにて確認して下さい。
"Pleiades"のダウンロード完了後、解凍して任意の場所にコピーします。
以下、コピー先を&bold(){&color(red){[PLEIADES_HOME]}}として記述します。
-&bold(){&color(blue){Full All in One (JREあり) -Java版の場合}
&bold(){&color(red){[PLEIADES_HOME]\eclipse}}フォルダ内の"eclipse.exe"を実行するだけで使用可能。
-&bold(){&color(blue){Full All in One (JREあり) -Ultimate版の場合}
&bold(){&color(red){[PLEIADES_HOME]\xampp}}フォルダ内の"setup_xampp.bat"を実行してXAMPPの設定を完了して下さい。
コマンドプロンプト画面で"Y or N"の質問形式でのインストールになりますが、全て"Y"で問題ありません。
完了したら&bold(){&color(red){[PLEIADES_HOME]\eclipse}}フォルダ内の"eclipse.exe"を実行するだけで使用可能。
**Android SDK のインストール
***Android SDKとは
Androidアプリケーションを開発するためのライブラリ。
ここからダウンロード
-[[Android Developers>http://developer.android.com/index.html]]
2010年9月23日現在で最新版は&bold(){2.2}です。
ダウンロードが完了したら、任意の場所に解凍する。 以下、コピー先を&bold(){&color(red){[SDK_HOME]}}として記述します。
+ pathの設定
解凍・コピーが完了したら環境変数に[SDK_HOME]のpathを通します。
&bold(){[コントロールパネル]-[システム]}を開いて[システムのプロパティ]画面を開きます。
#image(http://www35.atwiki.jp/andro_degu/pub/install/sys.gif,width=240,title=pathの設定(1),http://www35.atwiki.jp/andro_degu/pub/install/sys.gif,blank)
開いたら&bold(){[環境変数(N)]ボタン}を押下します。
#image(http://www35.atwiki.jp/andro_degu/pub/install/path.gif,width=240,title=pathの設定(2),http://www35.atwiki.jp/andro_degu/pub/install/path.gif,blank)
下段の"システム環境変数"の一覧表示の中から"Path"を選択して編集します。
&bold(){&color(red){[SDK_HOME]}}をPath変数の末尾に追加します。
2010-09-19T20:48:56+09:00
1284896936
-
まとめサイト作成支援ツール
https://w.atwiki.jp/andro_degu/pages/5.html
* まとめサイト作成支援ツールについて
@wikiには[[まとめサイト作成を支援するツール>>http://atwiki.jp/matome/]]があります。
また、
#matome_list
と入力することで、注目の掲示板が一覧表示されます。
利用例)#matome_listと入力すると下記のように表示されます
#matome_list
2010-09-17T19:57:10+09:00
1284721030