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

贵阳seo网站推广技巧网站推广排名优化多少钱

贵阳seo网站推广技巧,网站推广排名优化多少钱,wordpress让小工具支持简码,做海外网站 服务器放哪0 背景 开发要实现一个可以拖动的圆角小窗#xff0c;要求松手时#xff0c;哪边近些靠哪边。并且还规定了拖动范围。样式如下#xff1a; 1 实现 首先把 PopupWindow 的布局文件 pop.xml 实现 ?xml version1.0 encodingutf-8? R…0 背景 开发要实现一个可以拖动的圆角小窗要求松手时哪边近些靠哪边。并且还规定了拖动范围。样式如下 1 实现 首先把 PopupWindow 的布局文件 pop.xml 实现 ?xml version1.0 encodingutf-8? RelativeLayoutxmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:apphttp://schemas.android.com/apk/res-autoandroid:layout_width88dpandroid:layout_height132dpandroid:backgrounddrawable/radius_12android:idid/mini_popupandroid:visibilityvisiblecom.google.android.material.imageview.ShapeableImageViewandroid:idid/iv_live_coverandroid:layout_width88dpandroid:scaleTypefitXYandroid:layout_height132dpandroid:backgroundcolor/purple_200app:shapeAppearanceOverlaystyle/MiniDialogRoundedImageStyle /ImageViewandroid:idid/iv_closeandroid:layout_width16dpandroid:layout_height16dpandroid:layout_alignParentRighttrueandroid:layout_marginTop4dpandroid:layout_marginRight4dpandroid:srccolor/teal_200 / /RelativeLayout布局中圆角和 PopupWindow 的动画 style.xml !-- 圆角图片 --style nameMiniDialogRoundedImageStyleitem namecornerFamilyrounded/itemitem namecornerSize12dp/item/style!-- PopupWindow 的动画效果 --style namePopupWindowAnimationitem nameandroid:windowEnterAnimationanim/live_popup_window_in_anim/item/styleradius_12.xml ?xml version1.0 encodingutf-8? shape xmlns:androidhttp://schemas.android.com/apk/res/androidcorners android:radius12dp/solid android:colorcolor/white/ /shapeMyPopupWindow.java package com.example.myapplication.popupwindow;import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.res.Resources; import android.text.TextUtils; import android.util.DisplayMetrics; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; import android.widget.PopupWindow;import com.bumptech.glide.Glide; import com.example.myapplication.R;public class MyPopupWindow extends PopupWindow {private Context mContext;private View mRootView;// 背景private ImageView mBackground;// 关闭弹窗private ImageView mIvClose;// 弹窗的移动范围private int mMinX;private int mMinY;private int mMaxX;private int mMaxY;// 屏幕宽高private int mScreenWidth;public MyPopupWindow(Context context) {super(context);mContext context;mRootView View.inflate(mContext, R.layout.pop, null);mScreenWidth getScreenWidth(mContext);mMinX dp2px(12);mMaxX mScreenWidth - dp2px(12) - dp2px(88);mMinY dp2px(12);mMaxY dp2px(500);// 为了保证整体是圆角形状mRootView.findViewById(R.id.mini_popup).setClipToOutline(true);initView();}private void initView() {setContentView(mRootView);mBackground mRootView.findViewById(R.id.iv_live_cover);mIvClose mRootView.findViewById(R.id.iv_close);mIvClose.setOnClickListener(view - this.dismiss());// 小窗的宽高setHeight(dp2px(132));setWidth(dp2px(88));this.setTouchInterceptor(new View.OnTouchListener() {int orgX, orgY;int offsetX, offsetY;Overridepublic boolean onTouch(View view, MotionEvent motionEvent) {switch (motionEvent.getAction()) {case MotionEvent.ACTION_DOWN:orgX (int) motionEvent.getX();orgY (int) motionEvent.getY();break;case MotionEvent.ACTION_MOVE:offsetX (int) motionEvent.getRawX() - orgX;offsetY (int) motionEvent.getRawY() - orgY;// 限制 x 坐标offsetX Math.max(offsetX, mMinX);offsetX Math.min(offsetX, mMaxX);// 限制 y 坐标offsetY Math.max(offsetY, mMinY);offsetY Math.min(offsetY, mMaxY);update(offsetX, offsetY, -1, -1, true);break;case MotionEvent.ACTION_UP:// 小窗靠边if (offsetX mScreenWidth / 2) {offsetX mMinX;} else {offsetX mMaxX;}update(offsetX, offsetY, -1, -1, true);break;}// 避免 view 中的其他点击事件被吞掉return false;}});// 设置小窗背景this.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.abc_vector_test));// 出现的动画this.setAnimationStyle(R.style.PopupWindowAnimation);}public void show(View anchor) {this.showAtLocation(anchor, Gravity.NO_GRAVITY, mMaxX, mMaxY);}SuppressLint(CheckResult)public void setBackground(String url) {if (url ! null !TextUtils.isEmpty(url))Glide.with(mContext).load(url).into(mBackground);}public int dp2px(float dpValue) {return (int) (0.5f dpValue * Resources.getSystem().getDisplayMetrics().density);}public int getScreenWidth(Context context) {DisplayMetrics localDisplayMetrics new DisplayMetrics();((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);return localDisplayMetrics.widthPixels;} }最后在 MainActivity 中使用 mTextView findViewById(R.id.myView); if (mMyPopupWindow null) {mMyPopupWindow new MyPopupWindow(MainActivity.this); } mTextView.post(() - {mMyPopupWindow.show(mTextView); });
http://www.w-s-a.com/news/828224/

相关文章:

  • 做网站服务器有哪些电子商务网站建立
  • 网站开发的具体流程原材料价格查询网站
  • 深圳响应式网站建设深圳网站建设定制开发 超凡科技
  • 网站建设报价怎么差别那么大wordpress产品属性搭配
  • 高校网站建设情况报告范文pc建站网站
  • 做网站美工要学什么广东省建设厅网站首页
  • 深圳网站设计十年乐云seo网站建设 竞赛 方案
  • 新乡移动网站建设wordpress输出某一分类的文章
  • 花店网站开发设计的项目结构重庆网站建设培训班
  • 做网站的技术体系投资者互动平台官网
  • 北京网站建设公司哪家实惠企查查在线查询入口
  • 毕业设计做网站怎么样非微信官方网页自己做的网站
  • 昆明网站多端小程序设计重庆市住房和城乡建设厅网站
  • 网站制作技术人员国际新闻最新10条
  • 做同城特价的网站wordpress后台能修改模板文件
  • 网站信息可以边建设边组织产品展示网站源码php
  • 电子商务网站规划从哪些方面入手途牛企业网站建设方案
  • 莱阳网站定制易语言可以做网站嘛
  • 购物网站开发意义上海中小企业服务中心官网
  • 网站备案证书如何打开江苏网站建设电话
  • 深圳网站建设乐云seo搜索引擎优化seo目的
  • 中山城市建设集团网站网站建设设计基础
  • 网站开发流程莆田wordpress点播收费
  • 网站未及时续费浙江台州做网站的公司有哪些
  • 二级域名做网站好不好河源建网站
  • 公司网站的作用意义维护建设管理天津平台网站建设费用
  • 建设部网站如何下载国标规范上海影视公司
  • 企业官方网站地址通了网站建设
  • 专题网站可以做什么怎么做网站滑动图片部分h5
  • 什么是网站建设外包html 门户网站