看板 AndroidDev 關於我們 聯絡資訊
※ 引述《gmiloveyou (空)》之銘言: : 推 kewang:我比較好奇的是為什麼沒辦法用xml定義? 09/04 18:57 : → gmiloveyou:可以請iincho大指點一下嗎~因為想不出來要怎麼寫... 09/04 23:35 : → gmiloveyou:回kewnag大 ,因為我自訂的view裡還有其他的程式碼 09/04 23:36 : → gmiloveyou:嘗試改成XML之後錯誤百出 所以我想說只是增加一個按鈕 09/04 23:36 : → gmiloveyou:如果能在自定的VIEW裡增加就會比較輕鬆了 09/04 23:37 public MyView extends ViewGroup { private Button btn; private View otherView; . . . //三個constructor } <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" > <tw.kewang.MyView android:id="@+id/xxx" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout> 不是這樣用就可以了嗎?你要不要直接把code貼上來看看? -- 雜七雜八的kewang部落格 http://kewang.tw -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.163.25.228 ※ 編輯: kewang 來自: 118.163.25.228 (09/05 13:19) ※ 編輯: kewang 來自: 118.163.25.228 (09/05 13:31)
gmiloveyou:感謝指點~準備來去試試看! 09/05 23:53