討論串[問題] view 與 class 的問題
共 3 篇文章
首頁
上一頁
1
下一頁
尾頁
內容預覽:
我又試了一下,你原本的方法是沒錯的,會錯誤是因為你的outter.class這個view的建構子有問題;你的建構子裡面有toast一個訊息,但是你少了一行初始化的動作:this.context=context;所以你的view的context=null,於是toast產生錯誤,錯誤是這樣產生的。只要
(還有19個字)
內容預覽:
改成. <com.nextzero.testview.Outter. android:id="@+id/outter_layout". android:layout_height="wrap_content". android:layout_width="wrap_content"/>. 試試看.
(還有18個字)
內容預覽:
大家好. 我將一個class (叫做Outter) extends 一個 TextView. 然後在 MainActivity的 layout xml 中寫下了. <View. class="com.nextzero.testview.Outter". android:id="@+id/outter
(還有391個字)
首頁
上一頁
1
下一頁
尾頁