Loading…
Transcript

android-sdk/platforms/android-1.5/samples/NotePad

おらの町の図書館も対応してほしいなぁ。という方

@yanzm に D してください。お願いします!

libraroid@gmail.com にメールでもOKです!

sdk のサンプル Note pad アプリをカスタマイズしてみた。

menu・・・かな?

じゃあどうすればいいの?

<?xml version="1.0" encoding="utf-8" ?>

<LinearLayout

xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="fill_parent"

android:layout_height="fill_parent">

<ListView

android:id="@+id/android:list"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

/>

<TextView

android:id="@+id/android:empty"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="登録されたメモがありません。menu ボタンを押してメモを追加してください。"

/>

</LinearLayout>

<?xml version="1.0" encoding="utf-8" ?>

<LinearLayout

xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="fill_parent"

android:layout_height="fill_parent">

<ListView

android:id="@+id/android:list"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

/>

<ImageView

android:id="@+id/android:empty"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:src="@drawable/pressmenu"

/>

</LinearLayout>

よく使う機能なら最初から出ていたほうがいい

ボタンの配置って実は大事

add note の隣に delete は危険!

よく使うボタンは右端

間違えて押すと困るボタンは左端

<?xml version="1.0" encoding="utf-8" ?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_pressed="true" android:drawable="@drawable/edittitle_on" />

<item android:state_pressed="false" android:drawable="@drawable/edittitle_off" />

</selector>

<ImageButton

android:id="@+id/edittitlebtn"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentBottom="true"

android:layout_toLeftOf="@id/addnotebtn"

android:background="@drawable/edittitle_stateful"

/>

<ListView

android:id="@+id/android:list"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:divider="@drawable/title_line"

/>

ここのボタンの画像を変える

<dronjo.products.notepad.CustomCheckedTextView

xmlns:android="http://schemas.android.com/apk/res/android"

android:id="@+id/textview1"

android:layout_width="fill_parent"

android:layout_height="?android:attr/listPreferredItemHeight"

android:gravity="center_vertical"

android:paddingLeft="15dip"

android:paddingRight="35dip"

android:singleLine="true"

android:textSize="20sp"

android:checkMark="@drawable/checkbox_stateful"

/>

<?xml version="1.0" encoding="utf-8" ?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item

android:state_checked="true"

android:state_pressed="true"

android:drawable="@drawable/checkbox_on" />

<item

android:state_checked="true"

android:drawable="@drawable/checkbox_on" />

<item

android:state_checked="false"

android:state_pressed="true"

android:drawable="@drawable/checkbox_off" />

<item

android:state_checked="false"

android:drawable="@drawable/checkbox_off" />

</selector>

<style name="Theme.CustomDialog" parent="android:style/Theme.Dialog">

<item name="android:windowBackground">@drawable/dialogbox</item>

<item name="android:textColor">#ff000000</item>

</style>

<activity android:name="TitleEditor"

android:label="@string/title_edit_title"

android:theme="@style/Theme.CustomDialog"

android:windowSoftInputMode="stateVisible">

ぜひ、女子がおぉ!きゃー!すてき!となるアプリをお願いします。

ありがとうございました。

ちょっと宣伝させてね。その1

マーケットにアプリだしてます。

Libraroid - 図書館検索&予約

http://d.hatena.ne.jp/libraroid/

対応図書館リスト

自己紹介

対応図書館を増やすのに協力して

いただける方を大大大募集中です。

あんざい ゆき

@yanzm

ちょっと宣伝させてね。その2

大学院生(あと1ヶ月半だけ)

半年前くらいから Android はじめました。

最近、自分の HT03-A の中身を公開しました。。。

女子部発起人(嘘)

MLにやりませんかメール書いただけの人

andronavi さん の

「これが俺のアンドロイドだ!:001 ・・・」

http://andronavi.com/2010/02/7605

1. からっぽのListはやめようよ!

2. menu をカスタマイズしちゃえ

3. ボタン→画像でモテアプリ

4. 神は細部に宿る。実はラインが・・・

5. Custom Dialog で一段上へ

何をすればいいの・・・?

menu ボタンを押さないとわからない

ちょっと不親切・・・

画像にしちゃう!

CheckedTextView

(をちょっとごにょごにょした View)

ListView

item が無いときに文字を出してみる

ここをカスタマイズ

されてると、

おぉ!ってなるよ

menu (っぽいの) を作って最初から表示

説明がなくても使える

RelativeLayout

でも、ちょっと無愛想だし、カッコ悪い・・・

背景は透過にしてね

CheckedTextView って?

ImageView

title_line.png

widget です。ApiDemo では

Views -> Lists -> 10. Single choice list

button_bg2.png

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:id="@+id/parentlayout"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:background="@drawable/bg"

>

<ListView

android:id="@+id/android:list"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:divider="@drawable/title_line"

/>

<ImageView

android:id="@+id/menuimage"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentBottom="true"

android:background="@drawable/button_bg2"

/>

<ImageView

android:id="@+id/menuimageall"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentBottom="true"

android:background="@drawable/button_bg4"

android:visibility="gone"

/>

<ImageButton

android:id="@+id/deletebtn"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentBottom="true"

android:layout_alignParentLeft="true"

android:background="@drawable/delete_stateful"

/>

・・・

</RelativeLayout>

@drawable/edittitle_stateful.xml

menu ボタンを押したときに

translate animation

button_bg4.png

押したときの画像にもこだわりたい

edittitle_on

edittitle_off

@drawable/checkbox_stateful.xml

checkbox_off.png

checkbox_on.png

@values/styles.xml

デフォルトのDialog はこんな感じ

背景とかと合わない・・・

dialogbox.png

AndroidManifest.xml

xml だけで結構いろいろ見た目をカスタマイズできるので、

おしまい。

今日のスライド http://prezi.com/wk5hprc059gd