首页 文章 精选 留言 我的

精选列表

搜索[设置],共10000篇文章
优秀的个人博客,低调大师

Android写的一个设置图片查看器,可以调整透明度

先来看看效果吧: main.xml代码如下: 1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:layout_width="fill_parent" 4 android:layout_height="fill_parent" 5 android:orientation="vertical" > 6 7 <LinearLayout 8 android:layout_width="match_parent" 9 android:layout_height="wrap_content" > 10 11 <Button 12 android:id="@+id/button1" 13 android:layout_width="wrap_content" 14 android:layout_height="wrap_content" 15 android:text="增大透明度" /> 16 17 <Button 18 android:id="@+id/button2" 19 android:layout_width="wrap_content" 20 android:layout_height="wrap_content" 21 android:text="减小透明度" /> 22 23 <Button 24 android:id="@+id/button3" 25 android:layout_width="wrap_content" 26 android:layout_height="wrap_content" 27 android:text="下一张" /> 28 </LinearLayout> 29 <!-- 定义显示整体图片的ImageView --> 30 31 <ImageView 32 android:id="@+id/imageView1" 33 android:layout_width="wrap_content" 34 android:layout_height="wrap_content" 35 android:background="#0000ff" 36 android:scaleType="fitCenter" 37 android:src="@drawable/shuangta" /> 38 <!-- 定义显示局部图片的ImageView --> 39 40 <ImageView 41 android:id="@+id/imageView2" 42 android:layout_width="wrap_content" 43 android:layout_height="wrap_content" 44 android:layout_marginTop="10dp" 45 android:background="#0000ff" /> 46 47 </LinearLayout> 其中java代码为: 1 package android.demo; 2 3 import android.app.Activity; 4 import android.graphics.Bitmap; 5 import android.graphics.BitmapFactory; 6 import android.graphics.drawable.BitmapDrawable; 7 import android.os.Bundle; 8 import android.view.MotionEvent; 9 import android.view.View; 10 import android.view.View.OnClickListener; 11 import android.view.View.OnTouchListener; 12 import android.widget.Button; 13 import android.widget.ImageView; 14 15 public class AndroidDemo5Activity extends Activity { 16 // 定义一个访问图片的数组 17 int[] images = new int[] { R.drawable.lijiang, R.drawable.qiao, 18 R.drawable.shuangta, R.drawable.shui, R.drawable.xiangbi, 19 R.drawable.ic_launcher, }; 20 // 定义当前显示的图片 21 int currentImage = 2; 22 // 定义图片的初始透明度 23 private int alpha = 255; 24 25 @Override 26 protected void onCreate(Bundle savedInstanceState) { 27 // TODO Auto-generated method stub 28 super.onCreate(savedInstanceState); 29 setContentView(R.layout.main); 30 final Button plusButton = (Button) findViewById(R.id.button1); 31 final Button minuxButton = (Button) findViewById(R.id.button2); 32 final Button nextButton = (Button) findViewById(R.id.button3); 33 34 final ImageView imageview1 = (ImageView) findViewById(R.id.imageView1); 35 final ImageView imageview2 = (ImageView) findViewById(R.id.imageView2); 36 37 // 定义查看下一张图片的时间监听器 38 nextButton.setOnClickListener(new OnClickListener() { 39 40 @Override 41 public void onClick(View v) { 42 if (currentImage >= 5) { 43 currentImage = -1; 44 } 45 BitmapDrawable bitmap = (BitmapDrawable) imageview1 46 .getDrawable(); 47 // 如果图片还没有回收,先强制回收图片 48 if (!bitmap.getBitmap().isRecycled()) { 49 bitmap.getBitmap().recycle(); 50 } 51 // 改变ImageView的图片 52 imageview1.setImageBitmap(BitmapFactory.decodeResource( 53 getResources(), images[++currentImage])); 54 } 55 }); 56 57 // 定义改变图片透明度的方法 58 OnClickListener listener = new OnClickListener() { 59 60 @Override 61 public void onClick(View v) { 62 if (v == plusButton) { 63 alpha += 20; 64 } 65 if (v == minuxButton) { 66 alpha -= 20; 67 } 68 if (alpha > 255) { 69 alpha = 255; 70 } 71 if (alpha <= 0) { 72 alpha = 0; 73 } 74 // 改变图片的透明度 75 imageview1.setAlpha(alpha); 76 77 } 78 }; 79 80 // 为2个按钮添加监听器 81 plusButton.setOnClickListener(listener); 82 minuxButton.setOnClickListener(listener); 83 imageview1.setOnTouchListener(new OnTouchListener() { 84 85 @Override 86 public boolean onTouch(View arg0, MotionEvent arg1) { 87 // TODO Auto-generated method stub 88 BitmapDrawable bitmapDeaw = (BitmapDrawable) imageview1 89 .getDrawable(); 90 // 获取第一个图片显示框中的位图 91 Bitmap bitmap = bitmapDeaw.getBitmap(); 92 double scale = bitmap.getWidth(); 93 // 或许需要显示图片的开始点 94 int x = (int) (arg1.getX() * scale); 95 int y = (int) (arg1.getY() * scale); 96 if (x + 120 > bitmap.getWidth()) { 97 x = bitmap.getWidth() - 120; 98 } 99 if (y + 120 > bitmap.getHeight()) { 100 y = bitmap.getHeight() - 120; 101 } 102 103 // 显示图片的指定区域 104 imageview2.setImageBitmap(Bitmap.createBitmap(bitmap, x, y, 105 120, 120)); 106 imageview2.setAlpha(alpha); 107 return false; 108 } 109 }); 110 } 111 112 } ============================================================================== 本文转自被遗忘的博客园博客,原文链接:http://www.cnblogs.com/rollenholt/archive/2012/05/17/2506331.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

ES不设置副本是非常脆弱的,整个文章告诉了你为什么

Delaying Shard Allocation As discussed way back inScale Horizontally, Elasticsearch will automatically balance shards between your available nodes, both when new nodes are added and when existing nodes leave. Theoretically, this is the best thing to do. We want to recover missing primaries by promoting replicas as soon as possible. We also want to make sure resources are balanced evenly across the cluster to prevent hotspots. In practice, however, immediately re-balancing can cause more problems than it solves. For example, consider this situation: Node 19 loses connectivity to your network (someone tripped on the power cable) Immediately, the master notices the node departure. It determines what primary shards were on Node 19 and promotes the corresponding replicas around the cluster After replicas have been promoted to primary, the master begins issuing recovery commands to rebuild the now-missing replicas. Nodes around the cluster fire up their NICs and start pumping shard data to each other in an attempt to get back to green health status This process will likely trigger a small cascade of shard movement, since the cluster is now unbalanced. Unrelated shards will be moved between hosts to accomplish better balancing Meanwhile, the hapless admin who kicked out the power cable plugs it back in.Node 19 reboots and rejoins the cluster. Unfortunately, the node is informed that its existing data is now useless; the data being re-allocated elsewhere. So Node 19 deletes its local data and begins recovering a different set of shards from the cluster (which then causes a new minor re-balancing dance). If this all sounds needless and expensive, you’re right. It is, butonly when you know the node will be back soon. If Node 19 was truly gone, the above procedure is exactly what we want to happen. To help address these transient outages, Elasticsearch has the ability to delay shard allocation. This gives your cluster time to see if nodes will rejoin before starting the re-balancing dance. Changing the default delay By default, the cluster will wait one minute to see if the node will rejoin. If the node rejoins before the timer expires, the rejoining node will use its existing shards and no shard allocation occurs. This default time can be changed either globally, or on a per-index basis, by configuring thedelayed_timeoutsetting: PUT /_all/_settings { "settings": { "index.unassigned.node_left.delayed_timeout": "5m" } } By using the_allindex name, we can apply this setting to all indices in the cluster The default time is changed to 5 minutes The setting is dynamic and can be changed at runtime. If you would like shards to allocate immediately instead of waiting, you can setdelayed_timeout: 0. Delayed allocation won’t prevent replicas from being promoted to primaries. The cluster will still perform promotions as necessary to get the cluster back toyellowstatus. The allocation of the now-missing replicas will be the only process that is delayed Auto-cancellation of shard relocation What happens if the node comes backafterthe timeout expires, but before the cluster has finished moving shards around? In this case, Elasticsearch will check to see if the on-disk data matches the current "live" data in the primary shard. If the two shards are identical — meaning there have been no new documents, updates or deletes — the master will cancel the on-going rebalancing and restore the on-disk data. This is done since recovery of on-disk data will always be faster than transferring over the network, and since we can guarantee the shards are identical, the process is a win-win. If the shards have diverged (e.g. new documents have been indexed since the node went down), the recovery process will continue as normal. The rejoining node will delete it’s local, out-dated shards and obtain a new set. 本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/bonelee/p/7444495.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

禅道开源版 22.0.stable 发布,新增黑莓黑主题,增强功能开关设置

大家好,禅道开源版22.0.stable发布啦!本次更新推出“黑莓黑”色主题,用户可根据喜好自由选择。功能开关功能增强,管理员可一键关闭BI、AI、DevOps等十余项功能,相关入口将随之隐藏,打造极度简洁的专属工作区。导航栏与标签页支持内容超限自动收起,优化布局体验。 新版本将为用户带来更好的使用体验和更高的工作效率,感谢大家一直以来的支持和反馈,我们将继续努力提供更优秀的产品和服务! 新增功能点 主题: 新增“黑莓黑”主题 功能开关: 功能开关中关闭「通用看板」后,系统中隐藏「通用看板」相关入口 功能开关中关闭「BI」后,系统中隐藏「BI」相关入口 功能开关中关闭「AI」后,系统中隐藏「AI」相关入口 功能开关中关闭「DevOps」后,系统中隐藏「DevOps」相关入口 功能开关中关闭「套件」后,系统中隐藏「套件」相关入口 功能开关中关闭「自动化」后,系统中隐藏「自动化」相关入口 功能开关中关闭「用例库」后,系统中隐藏「用例库」相关入口 功能开关中关闭「项目集」后,系统中隐藏「项目集」相关入口 功能开关中增加相关可选功能 其他功能: 二、三级导航超出自动收到「其他」里 检索标签超出自动收到「更多」里 禅道本次发布数据如下: 本期优化的全部需求和Bug:请点击查看 ▼ 新增"黑莓黑"主题。 ▼ 后台功能开关中增加更多可选功能:项目集、套件、用例库、AI、BI、自动化。 ▼ 二、三级导航超出自动收到「其他」里。 ▼ 检索标签超出自动收到「更多」里。 下载链接 Windows集成环境 内置Apache、MySQL和PHP,一键启用 安装版(amd64)免安装版(amd64) Linux集成环境 内置Apache、MySQL和PHP,一键启用。必须解压到 /opt 目录下 免安装版(amd64)免安装版(arm64) 源码包(tar.xz) 可以通过tar命令或者解压工具解压 php7.0php7.1php7.2_7.4php8.1 源码包(zip) php7.0php7.1php7.2_7.4php8.1 DEB包 可以通过dpkg包管理器在Ubuntu和Debian系统下安装 php7.0php7.1php7.2_7.4php8.1 RPM包 可以通过rpm包管理器在Centos系统下安装 php7.0php7.1php7.2_7.4php8.1 禅道即时通讯客户端 20人以下免费,20人以上联系右侧客服获取试用 Windows10+ 安装版(amd64)免安装版(amd64) Linux(amd64) 安装版免安装版 (.tar.gz)免安装版 (.zip) Linux(arm64) 安装版 macOS(amd64) 安装版免安装版 macOS(arm64) 安装版 禅道即时通讯服务 20人以下免费,20人以上联系右侧客服获取试用 WindowsLinuxmacOS Docker镜像:点击这里 帮助手册 安装文档:https://www.zentao.net/book/zentaopms/455.html 升级文档:https://www.zentao.net/book/zentaopms/460.html 持续优化,定期更新,禅道一直在路上。

优秀的个人博客,低调大师

微软私有云分享(R2)22 计算机配置文件与基础设置

计算机配置文件是完全为了裸金属安装准备的。所以如果不准备使用裸金属安装,硬件配置文件在SCVMM2012 R2中也可以不用配置。 本章操作完全用图来表示(其实我准备文字了,但是貌似文字丢了…………),创建该文件没什么注意事项,但是需要注意的是,这种创建方法其实是利用到了一种虚拟化的技术,将操作系统安装在了VHD上,老实说这种架构本身其实是对性能有一定影响的。 对于将虚拟机放置在本地磁盘的做法来说,影响应该还蛮大的,如果是群集主机,存储是独立的,那问题不大。 本文转自 九叔 51CTO博客,原文链接:http://blog.51cto.com/jiushu/1433644,如需转载请自行联系原作者

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册