SherlockFragmentActivityをActionBarActivityに置き換えます。 メソッドはほぼ互換性があるのでActivityを置き換えるだけで大抵使えるようになります。 ただし、SherlockListActivityのようなFragmentActivity以外の基底クラスを持つActivityは用意されていません。独自に実装する必要があります。
[Android Tips] Support Library に追加された ActionBarActivity を使ってみた Support Library に ActionBar のサポートが追加 7月24日に Android SDK 4.3 (APIレベル18) がリリースされ、ADT r18 がリリースされ、Support Library r18 がリリースされました。Support Library r18 では v7 で ActionBar が正式にサポートされました! ということで新しく追加された ActionBarActivity を早速使ってみたのでメモしておきます。 Support Package v7 をインポートする ActionBarActivity を使う上でまず必要なのが Support Package v7 です。このライブラリは Android 2.1 (AP
画面の左側にオーバーレイでアプリの主なオプションを表示するパネル。 通常は隠れていて、画面の左端からスワイプするか、トップレベルにいるならアクションバーのアイコンをタップすることで表示される。 http://developer.android.com/design/patterns/navigation-drawer.html より Navigation Drawer を使う前に、Navigation Drawer デザインガイドにあるこのパターンのユースケースとデザイン原則をきちんと理解すること。 Drawer Layout を作成する support package にある DrawerLayout を利用する。 DrawerLayout をルートビューとし、その中にメインのコンンテンツを表示するビューと、NavigationDrawer として利用するビューを入れる。 <androi
3.0 以降では FragmentTransaction 時のアニメーションとして "fragmentOpenEnterAnimation" などのスタイルが用意されているのですが、 Support package の FragmentTransaction 時のアニメーションではスタイルは参照されていません。 FragmentTransaction 時の Animation は FragmentManager の loadAnimation() メソッドで決まります。 このメソッド内のロジックは次のようになっています。 1. Fragment の onCreateAnimation() の戻り値の Animation インスタンスが null じゃなかったからそれを使う 2. onCreateAnimation() の第3引数で渡した Fragment の mNextAnim フィールド
つまり、2.x で Fragment を使うときの注意点ですね。 まーた、はまりました orz Fragment が Activity の全画面を占めていて、FragmentTransaction を使って Activity 内で画面切り替えをする場合です。 setContentView() でセットする View のコンテナである FrameLayout の ID が android.R.id.content なので、これを利用して @Override protected void onCreate(Bundle savedInstance) { super.onCreate(savedInstance); Page1Fragment f = new Page1Fragment(); FragmentManager manager = getSupportFragmentManager(
Android 開発者必須!SupportPackage で SDK バージョン間の実装の違いを解消しよう SupportPackage とは? SupportPackage は Android 4.0 から導入された、 SDK バージョン (APIレベル) 間の実装の違いを解消するために提供されたサポートライブラリです。 Android 4.0 で多くの機能が追加され、また実装方法もより効率的に、よりシンプルになりました。Android 4.0 用のアプリを開発するときは問題ないのですが、それ以前の SDK バージョンに対応しようとする場合、クラスが参照できなかったり、改善される前の方法でしか実装できなかったりします。 分かりやすい例として Fragment が挙げられます。 Fragment は Activity 内で UI や振る舞いを分割するときに便利な、 Android 3.0
Android Support Package の Fragment から startActivityForResult() を使うときの注意点 今回は Support Package で Fragment を使う場合の注意点です。 まず、FragmentActivity で startActivityForResult() を使う場合、requestCode は 16bit 以下にしなければなりません。 http://tools.oesf.biz/android-4.0.1_r1.0/xref/frameworks/support/v4/java/android/support/v4/app/FragmentActivity.java#654 654 /** 655 * Modifies the standard behavior to allow results to be deliv
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く