在非Activity下的自定义toast

骨灰级菜虫 2013-08-02 11:32:18
在非Activity下的自定义toast 什么好方法!比如
getLayoutInflater?
findViewById
getApplicationContext()
等等!
...全文
150 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
骨灰级菜虫 2013-08-02
  • 打赏
  • 举报
回复
引用 1 楼 tanwei4199 的回复:
我擦 LZ都知道了还问啥 获得context就能随意自定义了
因为是非Activity下,getLayoutInflater? 、findViewById会出错。
荒颜 2013-08-02
  • 打赏
  • 举报
回复
我擦 LZ都知道了还问啥 获得context就能随意自定义了
骨灰级菜虫 2013-08-02
  • 打赏
  • 举报
回复
引用 4 楼 u010749756 的回复:
[quote=引用 3 楼 tanwei4199 的回复:] [quote=引用 2 楼 u010749756 的回复:] [quote=引用 1 楼 tanwei4199 的回复:] 我擦 LZ都知道了还问啥 获得context就能随意自定义了
因为是非Activity下,getLayoutInflater? 、findViewById会出错。[/quote] 额 Inflater = LayoutInflater.from(context); 然后用Inflater 来填充view 再使用view.findViewById........[/quote] 假如创建了findViewById方法,应该返回什么值[/quote] 好了,把那个改成null;谢谢
骨灰级菜虫 2013-08-02
  • 打赏
  • 举报
回复
引用 3 楼 tanwei4199 的回复:
[quote=引用 2 楼 u010749756 的回复:]
[quote=引用 1 楼 tanwei4199 的回复:]
我擦 LZ都知道了还问啥
获得context就能随意自定义了

因为是非Activity下,getLayoutInflater?
、findViewById会出错。[/quote]
额 Inflater = LayoutInflater.from(context);
然后用Inflater 来填充view
再使用view.findViewById........[/quote]

假如创建了findViewById方法,应该返回什么值
荒颜 2013-08-02
  • 打赏
  • 举报
回复
引用 2 楼 u010749756 的回复:
[quote=引用 1 楼 tanwei4199 的回复:] 我擦 LZ都知道了还问啥 获得context就能随意自定义了
因为是非Activity下,getLayoutInflater? 、findViewById会出错。[/quote] 额 Inflater = LayoutInflater.from(context); 然后用Inflater 来填充view 再使用view.findViewById........

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧