作者htury (冰点)
看板AndroidDev
标题[问题] 无法引入自订的DatePickerDialog的view?
时间Wed Sep 3 00:07:10 2014
大家好~~我重新整理一下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://webptt.com/cn.aspx?n=bbs/AndroidDev/M.1409674032.A.C24.html
1F:推 Deltaguita: R.layout.dialog 是你自定的吗? 建议你也贴上喔 09/03 01:04
2F:→ Deltaguita: 你的Error讯息也不够完整,绝对不只这样,也一并附上吧 09/03 01:05
※ 编辑: htury (36.228.184.13), 09/04/2014 20:43:35