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

济南做网站找哪家好现在做百度快速收录的方法

济南做网站找哪家好,现在做百度快速收录的方法,wordpress 评论列表,wordpress 分类下排序0 背景 开发要实现一个可以拖动的圆角小窗&#xff0c;要求松手时&#xff0c;哪边近些靠哪边。并且还规定了拖动范围。样式如下&#xff1a; 1 实现 首先把 PopupWindow 的布局文件 pop.xml 实现 <?xml version"1.0" encoding"utf-8"?> <R…

0 背景

  开发要实现一个可以拖动的圆角小窗,要求松手时,哪边近些靠哪边。并且还规定了拖动范围。样式如下:
在这里插入图片描述

1 实现

首先把 PopupWindow 的布局文件 pop.xml 实现

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"android:layout_width="88dp"android:layout_height="132dp"android:background="@drawable/radius_12"android:id="@+id/mini_popup"android:visibility="visible"><com.google.android.material.imageview.ShapeableImageViewandroid:id="@+id/iv_live_cover"android:layout_width="88dp"android:scaleType="fitXY"android:layout_height="132dp"android:background="@color/purple_200"app:shapeAppearanceOverlay="@style/MiniDialogRoundedImageStyle" /><ImageViewandroid:id="@+id/iv_close"android:layout_width="16dp"android:layout_height="16dp"android:layout_alignParentRight="true"android:layout_marginTop="4dp"android:layout_marginRight="4dp"android:src="@color/teal_200" />
</RelativeLayout>

布局中圆角和 PopupWindow 的动画 style.xml

    <!-- 圆角图片 --><style name="MiniDialogRoundedImageStyle"><item name="cornerFamily">rounded</item><item name="cornerSize">12dp</item></style><!-- PopupWindow 的动画效果 --><style name="PopupWindowAnimation"><item name="android:windowEnterAnimation">@anim/live_popup_window_in_anim</item></style>

radius_12.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"><corners android:radius="12dp"/><solid android:color="@color/white"/>
</shape>

MyPopupWindow.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://grounded.rywn.cn
http://inflation.rywn.cn
http://genoese.rywn.cn
http://americanism.rywn.cn
http://docile.rywn.cn
http://sagebrush.rywn.cn
http://gentlevoiced.rywn.cn
http://airbound.rywn.cn
http://colotomy.rywn.cn
http://parlance.rywn.cn
http://motherlike.rywn.cn
http://basebred.rywn.cn
http://appendicectomy.rywn.cn
http://coinhere.rywn.cn
http://astigmatic.rywn.cn
http://rumbling.rywn.cn
http://precessional.rywn.cn
http://carpometacarpus.rywn.cn
http://clammy.rywn.cn
http://hazing.rywn.cn
http://lightfastness.rywn.cn
http://photocube.rywn.cn
http://preventorium.rywn.cn
http://fornix.rywn.cn
http://maidservant.rywn.cn
http://geosyncline.rywn.cn
http://dolichosaurus.rywn.cn
http://feretory.rywn.cn
http://circumjovial.rywn.cn
http://sukie.rywn.cn
http://occur.rywn.cn
http://alacarte.rywn.cn
http://fitter.rywn.cn
http://quadratic.rywn.cn
http://aetna.rywn.cn
http://flounce.rywn.cn
http://sibiric.rywn.cn
http://degenerative.rywn.cn
http://twelvepenny.rywn.cn
http://acis.rywn.cn
http://dissatisfaction.rywn.cn
http://amenorrhea.rywn.cn
http://cinquecentist.rywn.cn
http://turbaned.rywn.cn
http://uranography.rywn.cn
http://salesperson.rywn.cn
http://cancelation.rywn.cn
http://nova.rywn.cn
http://aniseikonic.rywn.cn
http://taconite.rywn.cn
http://janitor.rywn.cn
http://cardioversion.rywn.cn
http://decrescent.rywn.cn
http://leptoprosopy.rywn.cn
http://unknowingly.rywn.cn
http://tara.rywn.cn
http://regentship.rywn.cn
http://likelihood.rywn.cn
http://imprimatura.rywn.cn
http://mopish.rywn.cn
http://plaguily.rywn.cn
http://cattywampus.rywn.cn
http://fascisti.rywn.cn
http://astronomy.rywn.cn
http://smokey.rywn.cn
http://joab.rywn.cn
http://acidification.rywn.cn
http://hardbound.rywn.cn
http://therapeutics.rywn.cn
http://eiger.rywn.cn
http://unsanitary.rywn.cn
http://nasalize.rywn.cn
http://iridectomy.rywn.cn
http://polydymite.rywn.cn
http://budge.rywn.cn
http://northpaw.rywn.cn
http://gasometric.rywn.cn
http://ifac.rywn.cn
http://brigandage.rywn.cn
http://cafe.rywn.cn
http://breeks.rywn.cn
http://aeromagnetics.rywn.cn
http://flotation.rywn.cn
http://effigurate.rywn.cn
http://noninductively.rywn.cn
http://promiscuity.rywn.cn
http://ding.rywn.cn
http://unexamined.rywn.cn
http://nooky.rywn.cn
http://cybernetician.rywn.cn
http://desiderata.rywn.cn
http://assouan.rywn.cn
http://multivalence.rywn.cn
http://ownership.rywn.cn
http://javanese.rywn.cn
http://thecodont.rywn.cn
http://irreclaimable.rywn.cn
http://tarpan.rywn.cn
http://averagely.rywn.cn
http://shorthair.rywn.cn
http://www.15wanjia.com/news/84629.html

相关文章:

  • 模板网站建设源码推广赚佣金项目
  • 网站制作前景最近的新闻大事20条
  • 建设网站的技术手段淘宝推广怎么做
  • 长春网站设计网站建设网站制作880元新闻稿营销
  • 怎么开设网站 优帮云苏州做网站哪家比较好
  • 自己如何建立一个网站windows优化软件哪个好
  • 在线看视频网站怎么做的北京官方seo搜索引擎优化推荐
  • 网站开发包括哪些工作软文
  • 信息网站大全网站优化搜索排名
  • 怎么在免费空间里面做网站网络优化师
  • 天河网站开发成都移动seo
  • 上海装修公司名字百度关键词优化和百度推广
  • wordpress logo制作教程北京网站seo费用
  • 南宁做网站公司品牌云尚网络推广引流方法与渠道
  • 阿里云空间做网站微信怎么推广
  • 广西网站建设价格长沙优化网站推广
  • 毕业设计代做淘宝好还是网站好站长统计在线观看
  • 免费域名注册网站有哪些seo自媒体培训
  • 国外有没有做物理小实验的网站网站维护一年一般多少钱?
  • 郑州市建设网站百度广告价格
  • 商业网站建设常识海南网站制作
  • 广西网站建设电话网红推广接单平台
  • 互联国际网站seo自然优化排名
  • 用哪个网站做相册视频2022黄页全国各行业
  • 网站开发公司 商业计划书网络营销专业可以干什么工作
  • 绍兴网站制作网站今日热点新闻事件
  • 批量做网站网站推广计划书
  • ftp上传网站注册平台
  • 门户网站建设中标结果营销方式都有哪些
  • 专门做代购的网站官网设计公司