0
私はlayout.xml
がFrameLayout
であり、もう1つはFrameLayout
です。FrameLayoutを使ってレイアウトを膨張させ、LinearLayoutに追加する
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.game_board_field, null);
:私はこれを行うコンストラクタで
Field f = new Field(width, height, color); //args can be changed if needed.
linearLayout.addView(f);
クラスField
内側:
私は処理ロジック、背景色など、私はこのような何かをしたい
を含むクラスField
サブクラスFrameLayout
を持っています
何かが追加されましたlinearLayout
その子カウントは0ではありませんが、私はの赤い正方形を見ることができませんはです。 私が間違っていることはありますか?
インフレ方法をに変更することを決めました。 ビュービュー= inflate(getContext()、R.layout.fragment_game_board_field、this); レイアウトに何かが現れていますが、その形状が乱れています。 – justmatt