layoutに関するlintanaのブックマーク (3)

  • 透明度を指定して色を作成 - Colorクラス - Android入門

    RGB(赤緑青)に加えて透明度を表すアルファ値を指定して色を作成する方法を確認します。「Color」クラスで用意されている「argb」メソッドを使います。 argb public static int argb(int alpha, int red, int green, int blue) Return a color-int from alpha, red, green, blue components. These component values should be [0..255], but there is no range check performed, so if they are out of range, the returned color is undefined. Parameters: alpha Alpha component [0..255] of the

  • Android | 位置を指定して子ビューを追加

    子ビューを追加する時に追加される位置を指定する方法を確認します。「FrameLayout」クラスの親クラスである「ViewGroup」クラスで用意されている「addView」メソッドを使います。 addView public void addView(View child, int index, LayoutParams params) Adds a child view with the specified layout parameters. Parameters: child the child view to add index the position at which to add the child params the layout parameters to set on the child 1番目の引数には追加したい子のビュー、3番目の引数には子ビューの表示レイアウトを

    Android | 位置を指定して子ビューを追加
  • レイアウト(7)-FrameLayout ウィジェットを重ね合わせて配置する。 - 愚鈍人

    FrameLayoutは、後に配置したウィジェットが先に配置したウィジェットの上に重ね合わせて表示される。 透過色を使って背景画像に上書きする形で、 下のレイヤーから上のレイヤーまで何階層かに渡って画像を合成して表示させるのに便利かな。 次の例は、FrameLayoutを使って大きさの異なるボタンを重ね合わせて表示する、xmlレイアウトファイルの例である。 リスト1(main.xml) このプログラムを実行すると、以下のような画面が表示される。 FrameLayoutの内部に最初に配置したbutton1ボタンが最背面に、 2つ目に配置したbutton2ボタンがbutton1ボタンの前面に、 最後に配置したbutton3ボタンが更にbutton2ボタンの前面にと、 後に配置したウィジェットほど前面に表示されているのがわかる。 動的にウィジェットの重ね合わせの順番を変更する。 FrameLay

    レイアウト(7)-FrameLayout ウィジェットを重ね合わせて配置する。 - 愚鈍人
  • 1