0
我在那裏我創建一個新的自定義的RelativeLayout這個活動:自定義的RelativeLayout
DrawView relativeLayout = new DrawView(this);
setContentView(relativeLayout);
在此的RelativeLayout的構造,我想一些自定義的矩形視圖添加到它.. 有了這個:
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
Rectangle rect = new Rectangle(context, "hey", 50, 10);
this.addView(rect);
Rectangle rect2 = new Rectangle(context, "hey2", 60, 70);
this.addView(rect2);
但是兩個矩形都未顯示。 你能幫我嗎?