liguofeng29’s blog

個人勉強用ブログだっす。

Android

Androidのイベント処理 - 匿名内部クラスでリスナー生成

多くのリスナーは一度だけ使われることが多いので、匿名型が相応しいのだ。事実上、現在最も使われる方式である。*Layoutは省略。 MainActivity.java package com.example.liguofeng.anonymouslistner;import android.support.v7.app.AppCompatActivity;imp…

Androidのイベント処理 - Activity自身でリスナー生成

①ActivityがListnerを継承し②メソッドをオーバライドするこの方法のデメリット ① Activityは画面初期化の役割が多いが、リスナーを作るのはよくないな。② そもそもActivityがListnerのインタフェースを実装するのがおかしいな。*Layoutは省略。 MainActivit…

Androidのイベント処理 - 外部クラスでリスナー生成

①外部クラスでリスナーを生成し②リスナーをViewに登録する。一般的には外部クラスでリスナー生成はしない。 理由としては主に①イベントは特定のGUI画面に所属するものなので、外部クラスにするのは集約面でよくない②外部クラスでリスナーを生成すると自由にE…

Androidのイベント処理 - 内部クラスでリスナー生成

①内部クラスでリスナーを生成し②リスナーをViewに登録する。*Layoutは省略。 MainActivity.java package com.example.liguofeng.innerclass;import android.support.v7.app.AlertDialog;import android.support.v7.app.AppCompatActivity;import android.os…

Androidのイベント処理 - 概要

Androidアプリにおいて最も重要な一つがイベント処理です。 たとえば、ボタンがクリックされたり、スライドしたりした場合、 その動作をキャッチして処理を行うのがイベント処理です。 Androidの場合、大きく二つの方法でイベント処理を行います。 1.リス…

AndroidのUI - ContextMenu

activity_main.xml

AndroidのUI - ActionBar

activity_main.xml

AndroidのUI - PopupMenu

activity_main.xml

AndroidのUI - MenuItem to Activity

AndroidManifest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.xxxxx.menutoactivity" > </manifest>

AndroidのUI - Menu

activity_main.xml

AndroidのUI - ProgressDialog

activity_main.xml

AndroidのUI - DatePickerDialogとTimePickerDialog

activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> </linearlayout>

AndroidのUI - PopupWindow

activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_horizontal"> </linearlayout>

AndroidのUI - DialogTheme

activity_main.xml

AndroidのUI - AlertDialog

activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > </relativelayout>

AndroidのUI - ViewFlipper

activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> </relativelayout>

AndroidのUI - TextSwitcher

activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> </linearlayout>

AndroidのUI - ImageSwitcher

activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> </linearlayout>

AndroidのUI - ViewSwitcher

activity_main.xml

AndroidのUI - ProgressBar & SeekBar & RatingBar

activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > </linearlayout>

AndroidのUI - StackView

activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> </linearlayout>

AndroidのUI - AdapterViewFilpper

activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> </relativelayout>

AndroidのUI - Spinner

activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> </linearlayout>

AndroidのUI - ExpandableListView

activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> </linearlayout>

AndroidのUI - GridView

activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> </linearlayout>

AndroidのUI - AutoCompleTextViewとMultiAutoCompleteTextView

activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> </linearlayout>

AndroidのUI - BaseAdapterでListView作成

activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> </linearlayout>

AndroidのUI - SimpleAdapterでListView作成

activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> </linearlayout>

AndroidのUI - ArrayAdapterでListView作成

activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> </linearlayout>

AndroidのUI - ListView

activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > </linearlayout>