[問題] 想把 xml layout 裝進自訂的class中
各位大大好
我想寫一個
Class MyLayoutView extends RelativeLayout{ ...}
後來我想要把它的子View從xml中實作出
<RelativeLayout> ...子View在這裡 ... </RelativeLayout>
可是這樣用 inflater inflate 出 view 再加進我的 MyLayoutView 的話
這樣 RelativeLayout就多一層了 囧
要怎樣讓我自訂的view透過類似 Activity中的 setContentView()
直接assign 給它呢?
例如在 MyLayoutView 的 constructor中
public MyLayoutView(){
this = xml的layout;
}
謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 211.21.125.247
※ 文章網址: http://www.ptt.cc/bbs/AndroidDev/M.1400641356.A.6C9.html
→
05/21 11:08, , 1F
05/21 11:08, 1F
推
05/21 12:32, , 2F
05/21 12:32, 2F
推
05/21 12:37, , 3F
05/21 12:37, 3F
→
05/21 17:34, , 4F
05/21 17:34, 4F