当前位置: 首页 > news >正文

昭通网站开发展示型网站有哪些

昭通网站开发,展示型网站有哪些,沭阳网站建设托管,微信朋友圈推广平台2019独角兽企业重金招聘Python工程师标准 项目做到一期收尾阶段#xff0c;突然要用到弹出窗口#xff0c;于是自然而然的就想起了PopupWindow这个组件了#xff0c;才发现平时用的少#xff0c;对这个组件几乎是完全无知的状态啊。 于是恶补一番 现在放出学… 2019独角兽企业重金招聘Python工程师标准 项目做到一期收尾阶段突然要用到弹出窗口于是自然而然的就想起了PopupWindow这个组件了才发现平时用的少对这个组件几乎是完全无知的状态啊。 于是恶补一番 现在放出学习成果——————请无视展示效果 救我理解来看PopupWindow 其实关键来说就是个Window容器既然是容器那么必然有他自己的宽高但是内容就由着开发者自己定义了。 所以第一步 先定义两个变量  PopupWindow pop;//弹出窗口的容器View view; //容器内放置的内容 然后我们来看初始化方法 private void initPopupWindow(String json) { if (json null || json.equals()) { ToastUtil.WarnImageToast(Phone_MainActivity.this, 今日油价获取失败, short); return; } String oil_text_90; String oil_text_93; String oil_text_97; String oil_text_0; OilBean ob gson.fromJson(json, OilBean.class); oil_text_0 ob.getShowapi_res_body().getList().get(0).getP0(); oil_text_90 ob.getShowapi_res_body().getList().get(0).getP90(); oil_text_93 ob.getShowapi_res_body().getList().get(0).getP93(); oil_text_97 ob.getShowapi_res_body().getList().get(0).getP97(); view this.getLayoutInflater().inflate(R.layout.popup_window, null); CustomRLayout oil90 (CustomRLayout) view .findViewById(R.id.oil_90_layout); CustomRLayout oil93 (CustomRLayout) view .findViewById(R.id.oil_93_layout); CustomRLayout oil97 (CustomRLayout) view .findViewById(R.id.oil_97_layout); CustomRLayout oil0 (CustomRLayout) view .findViewById(R.id.oil_0_layout); oil90.setRightText( oil_text_90); oil93.setRightText( oil_text_93); oil97.setRightText( oil_text_97); oil0.setRightText( oil_text_0); pop new PopupWindow(view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); pop.setAnimationStyle(R.style.popwin_anim_style); pop.setOutsideTouchable(false); view.setOnClickListener(new View.OnClickListener() { Override public void onClick(View v) { // TODO Auto-generated method stub pop.dismiss(); } }); } 整个过程非常简单 首先判断传入的网络json是有数据的然后对Json数据进行解析将解析后的数据放入到指定的View的组件中去。 注意观察可以发现在这个方法中用到了一个布局 R.layout.popup_window 我们来看看这个布局吧 ?xml version1.0 encodingutf-8?LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/android xmlns:customhttp://schemas.android.com/apk/res/com.dhcc.gpscarmanager_phone android:layout_widthfill_parent android:layout_heightfill_parent android:backgrounddrawable/oil_window_shape android:gravitycenter_horizontal android:orientationvertical TextView android:layout_widthmatch_parent android:layout_heightwrap_content android:gravitycenter android:padding10dip android:text今日油价 android:textColorcolor/white android:textSizedimen/text_normal_size / View android:layout_widthmatch_parent android:layout_height1dip android:layout_margin2dip android:backgroundcolor/line_gray / com.dhcc.gpscarmanager_phone.CustomView.CustomRLayout android:idid/oil_90_layout android:layout_widthmatch_parent android:layout_heightwrap_content android:layout_marginLeft2dip android:layout_marginRight2dip android:backgroundcolor/red custom:leftText90#汽油 custom:leftTextColorcolor/white custom:leftTextSizedimen/text_small_size custom:rightText6.98 custom:rightTextColorcolor/white custom:rightTextSizedimen/text_small_size / View android:layout_widthmatch_parent android:layout_height1dip android:layout_margin2dip android:backgroundcolor/line_gray / com.dhcc.gpscarmanager_phone.CustomView.CustomRLayout android:idid/oil_93_layout android:layout_widthmatch_parent android:layout_heightwrap_content android:layout_marginLeft2dip android:layout_marginRight2dip custom:leftText93#汽油 custom:leftTextColorcolor/white custom:leftTextSizedimen/text_small_size custom:rightText5.92 custom:rightTextColorcolor/white custom:rightTextSizedimen/text_small_size / View android:layout_widthmatch_parent android:layout_height1dip android:layout_margin2dip android:backgroundcolor/line_gray / com.dhcc.gpscarmanager_phone.CustomView.CustomRLayout android:idid/oil_97_layout android:layout_widthmatch_parent android:layout_heightwrap_content android:layout_marginLeft2dip android:layout_marginRight2dip custom:leftText97#汽油 custom:leftTextColorcolor/white custom:leftTextSizedimen/text_small_size custom:rightText7.62 custom:rightTextColorcolor/white custom:rightTextSizedimen/text_small_size / View android:layout_widthmatch_parent android:layout_height1dip android:layout_margin2dip android:backgroundcolor/line_gray / com.dhcc.gpscarmanager_phone.CustomView.CustomRLayout android:idid/oil_0_layout android:layout_widthmatch_parent android:layout_heightwrap_content android:layout_marginLeft2dip android:layout_marginRight2dip custom:leftText柴油 custom:leftTextColorcolor/white custom:leftTextSizedimen/text_small_size custom:rightText6.28 custom:rightTextColorcolor/white custom:rightTextSizedimen/text_small_size / View android:layout_widthmatch_parent android:layout_height1dip android:layout_margin2dip android:backgroundcolor/line_gray //LinearLayout 很简单的垂直线性布局具体效果看那个红色的窗口就知道了。 然后就是控制一下PopupWIndow在界面的什么位置显示了。 这里是写在OnclickListener中的 case R.id.main_tab02: /* * getIntentTool().intent_to(Phone_MainActivity.this, * Mix_RankList_Activity.class); */ if (pop ! null pop.isShowing()) { pop.dismiss(); } else if (pop ! null) { pop.showAtLocation(arg0, Gravity.BOTTOM, 0, 0);// popupWindow居中显示 } else if (pop null) { ToastUtil.WarnImageToast(Phone_MainActivity.this, 油价获取中, short); } break; 判断一下窗口是否初始化成功并且判断窗口是否在显示中这里要注意以下为了让窗口显示在界面底部代码需要这样写 pop.showAtLocation(arg0, Gravity.BOTTOM, 0, 0);// popupWindow底部显示pop.showAtLocation(arg0, Gravity.CENTER, 0, 0);// popupWindow底部显示 这样一个基本的PopupWindow基本上就做好了 但是还是没有动画效果 如何加如动画效果呢 这里要用到Style和属性动画的概念了 进入屏幕动画popupwindow_in.xml ?xml version1.0 encodingutf-8?set xmlns:androidhttp://schemas.android.com/apk/res/android translate android:fromXDelta0 android:toXDelta0 android:fromYDelta3000 android:toYDelta0 android:duration500 / /set 500毫秒内从组件位于屏幕的Y轴3000的方向向屏幕的0点方向移动 离开屏幕动画就是把进入动画反过来就好了 popupwindow_out.xml ?xml version1.0 encodingutf-8?set xmlns:androidhttp://schemas.android.com/apk/res/android translate android:fromXDelta0 android:toXDelta0 android:fromYDelta0 android:toYDelta3000 android:duration500 / /set 然后在Style中定义一下这个动画切换效果 style namepopwin_anim_style item nameandroid:windowEnterAnimationanim/popupwindow_in/item item nameandroid:windowExitAnimationanim/popupwindow_out/item/style 这样数据就可以显示了 最后在PopupWindow中初始化调用时设置一下就好了具体参见方法 initPopupWindow中的一代码 pop.setAnimationStyle(R.style.popwin_anim_style); 至此,一个带动画的PopupWindow就写完了整体的逻辑思路是这样的 1.先定义布局界面确定Window中要显示什么。 2.再初始化PopupWindow确定其显示的相关参数并将自定义的View与PopupWindow进行绑定。 3.确定Window的触发条件并确定窗口弹出位置 4.在anim中加入动画效果并在Style中定义改动画效果。 5.随后在初始化中利用setAnimationStyle方法设置动画。 来自为知笔记(Wiz) 转载于:https://my.oschina.net/t5xgkow/blog/510476
http://www.pierceye.com/news/473164/

相关文章:

  • 微网站 淘宝客wordpress备案号放置
  • html5 手机网站 模版网站信息员队伍建设
  • 基金会网站开发方案政务公开网站建设重点
  • 影视网站制作网页游戏的软件
  • 企业做网站的费用如何科目青色网站欣赏
  • 做视频网站怎么赚钱的网站开发流程的三个部分
  • 牡丹江市建设行业协会网站广西住房城乡建设厅网站首页
  • 重庆网站关键词排名优化免费网页代理的推荐
  • 定制型网站怎么做重庆软件开发公司有哪些
  • 自适应型网站建设网站建设搭建是什么意思
  • 网站建设能够不同地方网址大全12345
  • 做网批那个网站好校园网站界面建设
  • 免费网站建设php济南网站建设公司官网
  • 徐汇网站推广网络营销的四个特点
  • 简易做网站wordpress插件tag
  • 红酒 公司 网站建设青岛安装建设股份公司网站
  • 小米路由hd 做网站营销型网站策划 建设的考试题
  • 运河网站制作自主建站平台
  • 万网 网站建设合同最好的网站开发语言
  • 网站备案密码收不到典当 网站
  • 东莞网站建设推广服务网站建设开票单位
  • 贵港公司做网站东莞凤岗企业网站建设推广
  • 网站制作过程中碰到的问题微信怎么做链接推广产品
  • 做网站留后门是怎么回事视频网站开发需求分析
  • 关于做网站的了解点电子商务应用平台包括哪些
  • 垂直门户网站都有什么网站首页index.html
  • wordpress网站加载效果线上推销的方法
  • 网站都有什么语言杭州网络营销公司
  • 济南高新网站制作正规seo排名外包
  • 网站方案讲解技巧ppt的免费网站