useLibrary 'org.apache.http.legacy'
关于图片
.cacheInMemory(true)//使用内存缓存
.cacheOnDisk(true)//使用磁盘缓存
.showImageOnLoading(R.mipmap.ic_launcher)//设置正在下载的图片
.showImageForEmptyUri(R.mipmap.ic_launcher)//url为空或请求的资源不存在时
.showImageOnFail(R.mipmap.ic_launcher)//下载失败时显示的图片
.bitmapConfig(Bitmap.Config.RGB_565)//设置图片色彩模式
.imageScaleType(ImageScaleType.EXACTLY)//设置图片的缩放模式===imageView,,ScaleType
.displayer(new RoundedBitmapDisplayer(50))//设置图片圆角显示 弧度
//https://api.tianapi.com/wxnew/?key=48a7d7193e11bd2dd4a683b6e2f90a4f&num=10&page=
//http://www.93.gov.cn/93app/data.do?channelId=0&startNum=0 两个接口
先导包 给个intent权限 创建MyApplication 在MyApplication里面创建一个Oncreate new File(路径 environenent.getExternalStorageDirectory().getpath+"/aaa");
http://a.hiphotos.baidu.com/baike/pic/item/8ad4b31c8701a18b4f7365d3942f07082938fe96.jpg
图片地址
//图片设置
.memoryCacheExtraOptions(320, 450) // default = device screen dimensions 内存缓存文件的最大长宽
.threadPriority(Thread.NORM_PRIORITY - 2) // default 设置当前线程的优先级
.tasksProcessingOrder(QueueProcessingType.FIFO) // default
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new LruMemoryCache(10 * 1024 * 1024)) //可以通过自己的内存缓存实现
.memoryCacheSize(2 * 1024 * 1024) // 内存缓存的最大值
.memoryCacheSizePercentage(13) // default
.diskCache(new UnlimitedDiscCache(cacheDir)) // 磁盘缓存 --default 可以自定义缓存路径
.diskCacheSize(20 * 1024 * 1024) // 50 Mb sd卡(本地)缓存的最大值
.diskCacheFileCount(100) // 可以缓存的文件数量
// default为使用HASHCODE对UIL进行加密命名, 还可以用MD5(new Md5FileNameGenerator())加密
.diskCacheFileNameGenerator(new HashCodeFileNameGenerator())
.imageDownloader(new BaseImageDownloader(this)) // default
.defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
.writeDebugLogs() // 打印debug log
ImageLoaderConfiguration configuration=new ImageLoaderConfiguration.Builder(this)
.memoryCacheExtraOptions(400, 800)//缓存图片最大的长和宽
.threadPoolSize(2)//线程池的数量
.threadPriority(4)
.memoryCacheSize(2*1024*1024)//设置内存缓存区大小
.diskCacheSize(20*1024*1024)//设置sd卡缓存区大小
.diskCache(new UnlimitedDiscCache(cachefile))//自定义sd缓存目录
.writeDebugLogs()//打印日志内容
.diskCacheFileNameGenerator(new Md5FileNameGenerator())//给缓存的文件名进行md5加密处理
.build();
ImageLoader.getInstance().init(configuration);
这个是
//第二步
options=new DisplayImageOptions.Builder()
.cacheInMemory(true)//使用内存缓存
.cacheOnDisk(true)//使用磁盘缓存
.showImageOnLoading(R.mipmap.ic_launcher)//设置正在下载的图片
.showImageForEmptyUri(R.mipmap.ic_launcher)//url为空或请求的资源不存在时
.showImageOnFail(R.mipmap.ic_launcher)//下载失败时显示的图片
.bitmapConfig(Bitmap.Config.RGB_565)//设置图片色彩模式
.imageScaleType(ImageScaleType.EXACTLY)//设置图片的缩放模式
.build();
(把 数据在给设置一下)
ImageLoader.getInstance().displayImage(pics[0],holder.text_img,options);
app:tabGravity="center"
app:tabIndicatorColor="@color/colorAccent"
app:tabMode="scrollable"
app:tabSelectedTextColor="@color/colorPrimaryDark"
app:tabTextColor="@color/colorPrimary"
网页搜索 android studio aapt2
报错问题
android.enableAapt2=false
Build里面
Clean project
Rebuild project
android : layout 小写
int newHight = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
ptr:ptrDrawable="@drawable/default_ptr_flip"
ptr:ptrAnimationStyle="flip"
ptr:ptrHeaderBackground="#383838"
ptr:ptrHeaderTextColor="#FFFFFF"
compile 'com.youth.banner:banner:1.4.10'
compile 'com.github.userswlwork:pull-to-refresh:1.0.0'
android:maxLines="1"
android:ellipsize="end"
xmlns:ptr="http://schemas.android.com/apk/res-auto"
com.nostra13.universalimageloader.core.ImageLoader.getInstance().displayImage(path.toString(),imageView,ImageLoaderutils.getImageOption(context));
public static void initImageLoader(Context context){
File caheche = new File(Environment.getExternalStorageDirectory().getPath() + "/aaa");
ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(context).build();
}
//支持js
WebSettings settings = webView.getSettings();
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setJavaScriptEnabled(true);
//在本页面加载网页,不调用系统浏览器
webView.setWebViewClient(new WebViewClient());
intent.putExtra("web_url")
intent.getStringEtrx("web_url")