- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Android strong technology
Android应用比较好的实现方式1.Popupwindow实现弹出菜单效果popupwindow实现弹出菜单功能非常实用,在有布局中经常出现,给用户体验非常不错, 先看效果:2. main.xml?xml version=1.0 encoding=utf-8?RelativeLayout xmlns:android=/apk/res/android android:layout_height=match_parent android:layout_width=match_parent android:background=@drawable/bg_5 ListView android:id=@+id/lv_id android:layout_height=wrap_content android:layout_width=match_parent / LinearLayout android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal android:layout_alignParentBottom=true android:background=@drawable/title_weekend_bg Button android:id=@+id/but_menu android:layout_width=wrap_content android:layout_height=wrap_content android:text=菜单 android:background=@drawable/button_select/ Button android:id=@+id/but_news android:layout_width=wrap_content android:layout_height=wrap_content android:text=新闻 android:background=@drawable/button_select android:layout_marginLeft=10dp/ /LinearLayout/RelativeLayout3. popupmenu.xmlLinearLayout xmlns:android=/apk/res/android android:layout_height=match_parent android:layout_width=match_parent android:background=@drawable/main android:orientation=vertical TextView android:id=@+id/open_id android:layout_width=wrap_content android:layout_height=wrap_content android:text=打开/ TextView android:id=@+id/save_id android:layout_width=wrap_content android:layout_height=wrap_content android:text=w保存/ TextView android:id=@+id/my_id android:layout_width=wrap_content android:layout_height=wrap_content android:text=我的留言/ TextView android:id=@+id/about_id android:layout_width=wrap_content android:layout_height=wrap_content android:text=关于我们/ TextView android:id=@+id/help_id android:layout_width=wrap_content android:layout_height=wrap_content android:text=帮助//LinearLayout?4. 核心java代码:按下按钮时显示弹出窗口menuBut.setOnClickListener(new OnClickListener() { @Overridepublic void onClick(View v) {LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);final View view = infla
文档评论(0)