タグ

ブックマーク / y-anz-m.blogspot.com (5)

  • Droid Kaigi 2016 で講演してきました。

    ► 2024 (4) ► 6月 (1) ► 3月 (2) ► 2月 (1) ► 2023 (6) ► 12月 (1) ► 7月 (1) ► 5月 (1) ► 4月 (1) ► 3月 (2) ► 2022 (17) ► 12月 (2) ► 11月 (3) ► 9月 (2) ► 8月 (2) ► 7月 (2) ► 5月 (2) ► 4月 (2) ► 3月 (1) ► 2月 (1) ► 2021 (46) ► 12月 (2) ► 10月 (1) ► 9月 (1) ► 8月 (3) ► 7月 (2) ► 6月 (5) ► 5月 (12) ► 4月 (7) ► 3月 (5) ► 2月 (7) ► 1月 (1) ► 2020 (44) ► 12月 (6) ► 11月 (5) ► 10月 (1) ► 9月 (1) ► 8月 (2) ► 7月 (2) ► 6月 (7) ► 5月 (4) ► 3月 (8)

  • Android SeekBar のトラックとつまみの位置を合わせる

    SeekBar でつまみやトラック部分をオリジナルの画像にしたら、バーの進み具合がつまみの中心に合わない、という状況になったことがあると思います。 実は style の設定で合うようにすることができます。 以下では、つまみ部分に星型の画像を、トラック部分に 9patch の画像を用意しています。 つまみ res/values/style.xml で次のように定義し <resources> <style name="AppTheme" parent="android:Theme.Light"> <item name="android:seekBarStyle">@style/MySeekBar</item> </style> <style name="MySeekBar" parent="@android:style/Widget.SeekBar"> <item name="android:

  • Android View の位置を取得する

    View クラスのメソッドで位置やサイズを取得するメソッドがいくつかあるので紹介します。 ■ getLocationInWindow(int[] location) ウィンドウ上でのこの View の位置を計算します。引数は長さが2以上の int 配列で、Index 0 に x 座標、Index 1 に y 座標の値が入ります。 http://tools.oesf.biz/android-4.0.1_r1.0/xref/frameworks/base/core/java/android/view/View.java#12047 12047 public void getLocationInWindow(int[] location) { 12048 if (location == null || location.length < 2) { 12049 throw new IllegalA

    Android View の位置を取得する
  • Android FragmentTransaction のまとめ

    add / remove add(int containerViewId, Fragment fragment, String tag) ・Activity の状態に fragment を追加 ・fragment がすでに Activity に追加されている場合なにも起こらない(detach したインスタンスを add しても表示されない) ・containerViewId が 0 ではない場合、fragment の onCreateView() が null でなければそれを containerViewId の ViewGroup に追加 onAttach() → onCreate() → onCreateView() → onActivityCreated() → onStart() → onResume() * remove() 後に detach() された後の場合は onAtta

  • Facebookとそれ以外でACTION_SENDで渡すテキストを変える

    Facebookはポリシーで投稿のpre-fillを禁止している(https://developers.facebook.com/policy/)ため、テキストの代わりにリンクを共有することがよくあります。 前回の「「ギャラリーから選択」と「カメラで撮影」を1つのchooserで表示する。」と同じ方法を使うと、Facebookとそれ以外でIntent.EXTRA_TEXTに含める文字列を変えることができます。 /** * Facebook ではリンクを共有し、それ以外(FB Messenger 含む)ではテキストを共有する */ private void share() { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); List<ResolveInfo> resInfo = get

  • 1