[問題] (加完整code)無法引入自訂的DatePickerDialog的view
大家好~~我重新整理一下code
error message
http://chopapp.com/#a1ne0d3l
MyActivity
http://pastie.org/9526501
activity加入fragmaent
http://pastie.org/9526776
接下來分別是layout的XML
這是times-square原本的dialog layout
dialog.xml
http://pastie.org/9526778
fragment.xml
http://pastie.org/9526780
我的按鈕是用自訂的view加onTouch
my_click_view.xml
http://pastie.org/9526783
請大家不吝指教~~
謝謝
============================
舊文......
這問題卡了我一陣子,不知道各位先進是否能指點一下?
我的觀念哪邊錯了,或者有文章可以參考,
謝謝各位
我有在stock overflow發問,比較完整的code在那邊
http://ppt.cc/ci3i
主要是我需要引用android-times-square
sample是在Activity下被onClick(),因此沒有getActivity()就可正常work
當我用fragment當底層的時候
dialogView =
(CalendarPickerView)getActivity().getLayoutInflater().inflate(
R.layout.dialog, null, false);
我取不到framework預設Dialog的XML
error message:"android.view.InflateException:
Binary XML file line #1: Error inflating
class com.squareup.timessquare.CalendarPickerView"
那我試過
fragment class放在Activity的inner class
使用dialogView =(CalendarPickerView)inflater.inflate(
R.layout.dialog, null, false);
但是fragment 為inner class,強制要static,inflate()不是static,所以無法使用
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.25.210.100
※ 文章網址: http://www.ptt.cc/bbs/AndroidDev/M.1409674032.A.C24.html
推
09/03 01:04, , 1F
09/03 01:04, 1F
→
09/03 01:05, , 2F
09/03 01:05, 2F
※ 編輯: htury (36.228.184.13), 09/04/2014 20:43:35
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):