首页 文章 精选 留言 我的

精选列表

搜索[加载进度条],共10005篇文章
优秀的个人博客,低调大师

Glide 加载图片背景变绿

Glide使用bitmap的编码问RGB565,所以有时的时候由于过度压缩导致了图片变绿。 所以要改变一下Glide的bitmap编码。 import android.content.Context; import com.bumptech.glide.Glide; import com.bumptech.glide.GlideBuilder; import com.bumptech.glide.load.DecodeFormat; import com.bumptech.glide.module.GlideModule; /** * Created by zhaoyong on 2016/1/26. * 增加图片清晰度 */ public class GlideConfiguration implements GlideModule{ @Override public void applyOptions(Context context, GlideBuilder builder) { builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888); } @Override public void registerComponents(Context context, Glide glide) { } } 然后AndroidManifext中: <meta-data android:name="com.xxx.xxx.xxx.GlideConfiguration" android:value="GlideModule"/> ,如需转载请自行联系原作者

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

android 启动延迟加载画面

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 LoginActivity package com.xkhouse.erm.erm; import android.app.Activity; import android.os.Bundle; import android.view.Window; /*publicclassLoginActivityextendsActivity{ @Override protectedvoidonCreate(BundlesavedInstanceState){ //requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); } }*/ publicclassLoginActivityextendsActivity{ @Override protectedvoidonCreate(BundlesavedInstanceState){ super.onCreate(savedInstanceState); /* *设置隐藏标题栏 */ requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_login); } } /*publicclassSplashActivityextendsActivity{ privatefinalintSPLASH_DISPLAY_LENGHT=1000;//延迟一秒 @Override protectedvoidonCreate(BundlesavedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.jiazai); newHandler().postDelayed(newRunnable(){ //为了减少代码使用匿名Handler创建一个延时的调用 publicvoidrun(){ Intenti=newIntent(SplashActivity.this,LoginActivity.class); //通过Intent打开最终真正的主界面Main这个Activity SplashActivity.this.startActivity(i);//启动Main界面 SplashActivity.this.finish();//关闭自己这个开场屏 } },SPLASH_DISPLAY_LENGHT); } }*/ SplashActivity packagecom.xkhouse.erm.erm; importandroid.app.Activity; importandroid.content.Intent; importandroid.os.Bundle; importandroid.os.Handler; importandroid.view.Window; importandroid.view.WindowManager; /*publicclassSplashActivityextendsActivity{ privatefinalintSPLASH_DISPLAY_LENGHT=6000;//延迟六秒 @Override protectedvoidonCreate(BundlesavedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.splash); newHandler().postDelayed(newRunnable(){ publicvoidrun(){ IntentmainIntent=newIntent(SplashActivity.this, LoginActivity.class); SplashActivity.this.startActivity(mainIntent); SplashActivity.this.finish(); } },SPLASH_DISPLAY_LENGHT); } }*/ publicclassSplashActivityextendsActivity{ finalprivateintSPLASH_TIME=1000; @Override protectedvoidonCreate(BundlesavedInstanceState){ super.onCreate(savedInstanceState); /* *设置全屏 */ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); /* *设置隐藏标题栏 */ requestWindowFeature(Window.FEATURE_NO_TITLE); /* *2秒后跳转到主界面 */ newHandler().postDelayed(newRunnable(){ publicvoidrun(){ launchMainActivity(); } },SPLASH_TIME); setContentView(R.layout.activity_splash); } /* *利用Intent切换到主Activity */ privatevoidlaunchMainActivity(){ /* *创建一个intent,从当前Activity指向要跳转的Activity */ Intentintent=newIntent(this,LoginActivity.class); /* *启动目标Activity */ startActivity(intent); /* *启动画面只需要程序开始时显示一次,显示完后即可退出 */ finish(); } } layout目录下 activity_splash.xml <?xmlversion= "1.0" encoding= "utf-8" ?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" android:layout_height= "fill_parent" android:layout_width= "fill_parent" android:orientation= "vertical" > <ImageViewandroid:layout_height= "fill_parent" android:layout_width= "fill_parent" android:scaleType= "fitCenter" android:src= "@drawable/splash" ></ImageView> </LinearLayout> AndroidMainfest.xml <?xmlversion= "1.0" encoding= "utf-8" ?> <manifestxmlns:android= "http://schemas.android.com/apk/res/android" package = "com.xkhouse.erm.erm" > <application android:allowBackup= "true" android:icon= "@drawable/logo" android:label= "@string/app_name" android:theme= "@android:style/Theme.NoTitleBar.Fullscreen" > <activity android:name= "com.xkhouse.erm.erm.SplashActivity" android:label= "@string/app_name" > <intent-filter> <actionandroid:name= "android.intent.action.MAIN" /> <categoryandroid:name= "android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activityandroid:name= ".LoginActivity" ></activity> </application> </manifest> 本文转自 liang3391 51CTO博客,原文链接:http://blog.51cto.com/liang3391/1631840

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

android:通过URL加载ImageView

iphone上实现很简单,一行代码: imageView.image=[UIImageimageWithContentsOfURL:theURL]; android: 两种方法: Bitmap bimage= getBitmapFromURL(bannerpath); image.setImageBitmap(bimage); public static Bitmap getBitmapFromURL(String src) { try { Log.e("src",src); URL url = new URL(src); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.connect(); InputStream input = connection.getInputStream(); Bitmap myBitmap = BitmapFactory.decodeStream(input); Log.e("Bitmap","returned"); return myBitmap; } catch (IOException e) { e.printStackTrace(); Log.e("Exception",e.getMessage()); return null; } } or try it public static Bitmap loadBitmap(String url) { Bitmap bitmap = null; InputStream in = null; BufferedOutputStream out = null; try { in = new BufferedInputStream(new URL(url).openStream(), IO_BUFFER_SIZE); final ByteArrayOutputStream dataStream = new ByteArrayOutputStream(); out = new BufferedOutputStream(dataStream, IO_BUFFER_SIZE); copy(in, out); out.flush(); final byte[] data = dataStream.toByteArray(); BitmapFactory.Options options = new BitmapFactory.Options(); //options.inSampleSize = 1; bitmap = BitmapFactory.decodeByteArray(data, 0, data.length,options); } catch (IOException e) { Log.e(TAG, "Could not load Bitmap from: " + url); } finally { closeStream(in); closeStream(out); } return bitmap; } 方法2 Drawable drawable = LoadImageFromWebOperations(bannerpath); image.setImageDrawable(drawable); private Drawable LoadImageFromWebOperations(String url) { try { InputStream is = (InputStream) new URL(url).getContent(); Drawable d = Drawable.createFromStream(is, "src name"); return d; }catch (Exception e) { System.out.println("Exc="+e); return null; } } 搞定! 本文转自老Zhan博客园博客,原文链接:http://www.cnblogs.com/mybkn/archive/2012/05/24/2515913.html,如需转载请自行联系原作者

资源下载

更多资源
腾讯云软件源

腾讯云软件源

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

Nacos

Nacos

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

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册