作者:
htury (冰點)
2014-09-03 00:07:10大家好~~我重新整理一下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,所以無法使用