本文整理汇总了Java中org.xutils.image.ImageOptions类的典型用法代码示例。如果您正苦于以下问题:Java ImageOptions类的具体用法?Java ImageOptions怎么用?Java ImageOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageOptions类属于org.xutils.image包,在下文中一共展示了ImageOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import org.xutils.image.ImageOptions; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ImageOptions imageOptions = new ImageOptions.Builder()
// 加载中或错误图片的ScaleType
//.setPlaceholderScaleType(ImageView.ScaleType.MATRIX)
// 默认自动适应大小
// .setSize(...)
.setIgnoreGif(false)
// 如果使用本地文件url, 添加这个设置可以在本地文件更新后刷新立即生效.
//.setUseMemCache(false)
.setImageScaleType(ImageView.ScaleType.CENTER).build();
x.image().bind(iv_big_img, getIntent().getStringExtra("url"), imageOptions);
// assets file
//x.image().bind(iv_big_img, "assets://test.gif", imageOptions);
// local file
//x.image().bind(iv_big_img, new File("/sdcard/test.gif").toURI().toString(), imageOptions);
//x.image().bind(iv_big_img, "/sdcard/test.jpg", imageOptions);
//x.image().bind(iv_big_img, "file:///sdcard/test.gif", imageOptions);
//x.image().bind(iv_big_img, "file:/sdcard/test.gif", imageOptions);
}
示例2: onViewCreated
import org.xutils.image.ImageOptions; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
imageOptions = new ImageOptions.Builder()
.setSize(DensityUtil.dip2px(120), DensityUtil.dip2px(120))
.setRadius(DensityUtil.dip2px(5))
// 如果ImageView的大小不是定义为wrap_content, 不要crop.
.setCrop(true) // 很多时候设置了合适的scaleType也不需要它.
// 加载中或错误图片的ScaleType
//.setPlaceholderScaleType(ImageView.ScaleType.MATRIX)
.setImageScaleType(ImageView.ScaleType.CENTER_CROP)
.setLoadingDrawableId(R.mipmap.ic_launcher)
.setFailureDrawableId(R.mipmap.ic_launcher)
.build();
imageListAdapter = new ImageListAdapter();
imageListView.setAdapter(imageListAdapter);
// 加载url请求返回的图片连接给listview
// 这里只是简单的示例,并非最佳实践,图片较多时,最好上拉加载更多...
for (String url : imgSites) {
loadImgList(url);
}
}
示例3: CyclopediaAdapter
import org.xutils.image.ImageOptions; //导入依赖的package包/类
public CyclopediaAdapter(List<CyclopediaModel> data, Context context) {
if (data == null) {
data = new ArrayList<>();
}
this.data = data;
this.inflater = LayoutInflater.from(context);
childCount = new ArrayList<>();
childCount.add(8);
childCount.add(8);
childCount.add(1);
childCount.add(1);
childCount.add(8);
childCount.add(8);
options = new ImageOptions.Builder()
.setFailureDrawableId(R.mipmap.kungfu1)
.setLoadingDrawableId(R.mipmap.kungfu6)
.build();
moreType = new ArrayList<>();
moreType.add(11);
moreType.add(11);
moreType.add(11);
moreType.add(11);
moreType.add(11);
moreType.add(11);
}
示例4: bindCommonImage
import org.xutils.image.ImageOptions; //导入依赖的package包/类
/**
* 正常图片显示
*
* @param iv
* @param url
* @param option
*/
public void bindCommonImage(ImageView iv, String url, boolean option) {
if (option) {
options = new ImageOptions.Builder().setLoadingDrawableId(R.mipmap.ic_launcher).setFailureDrawableId(R.mipmap.ic_launcher).build();
x.image().bind(iv, url, options);
} else {
x.image().bind(iv, url);
}
}
示例5: bindCircularImage
import org.xutils.image.ImageOptions; //导入依赖的package包/类
/**
* 圆形图片显示
*
* @param iv
* @param url
* @param option
*/
public void bindCircularImage(ImageView iv, String url, boolean option) {
if (option) {
options = new ImageOptions.Builder().setLoadingDrawableId(R.mipmap.ic_launcher).setFailureDrawableId(R.mipmap.ic_launcher).setCircular(true).build();
x.image().bind(iv, url, options);
} else {
x.image().bind(iv, url);
}
}
示例6: displayImage
import org.xutils.image.ImageOptions; //导入依赖的package包/类
@Override
public void displayImage(Activity activity, String path, GFImageView imageView, Drawable defaultDrawable, int width, int height) {
ImageOptions options = new ImageOptions.Builder()
.setLoadingDrawable(defaultDrawable)
.setFailureDrawable(defaultDrawable)
.setConfig(mImageConfig)
.setSize(width, height)
.setCrop(true)
.setUseMemCache(false)
.build();
x.image().bind(imageView, "file://" + path, options);
}
示例7: displayImage
import org.xutils.image.ImageOptions; //导入依赖的package包/类
@Override
public void displayImage(Activity activity, String path, ImageView imageView, int width, int height) {
ImageOptions options = new ImageOptions.Builder()//
.setLoadingDrawableId(R.drawable.ic_default_image)//
.setFailureDrawableId(R.drawable.ic_default_image)//
.setConfig(Bitmap.Config.RGB_565)//
.setSize(width, height)//
.setCrop(false)//
.setUseMemCache(true)//
.build();
x.image().bind(imageView, Uri.fromFile(new File(path)).toString(), options);
}
示例8: displayImagePreview
import org.xutils.image.ImageOptions; //导入依赖的package包/类
@Override
public void displayImagePreview(Activity activity, String path, ImageView imageView, int width, int height) {
ImageOptions options = new ImageOptions.Builder()//
.setConfig(Bitmap.Config.RGB_565)//
.setSize(width, height)//
.setCrop(false)//
.setUseMemCache(true)//
.build();
x.image().bind(imageView, Uri.fromFile(new File(path)).toString(), options);
}
示例9: onCreate
import org.xutils.image.ImageOptions; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_home_second);
x.view().inject(this);
Intent intent = getIntent();
id = intent.getStringExtra("id");
WebViewClient client = new WebViewClient();
mWeb.setWebViewClient(client);
mWeb.loadUrl(MyUrl.HOME_SECOND_START + id + MyUrl.HOME_SECOND_END);
options= new ImageOptions.Builder().setCircular(true).build();
setupView();
}
示例10: ItemTwoAdapter
import org.xutils.image.ImageOptions; //导入依赖的package包/类
public ItemTwoAdapter(List<CyclopediaModel.ListBean> data, Context context) {
if (data == null) {
data = new ArrayList<>();
}
this.data = data;
this.inflater = LayoutInflater.from(context);
options = new ImageOptions.Builder()
.setCircular(true)
.setFailureDrawableId(R.mipmap.kungfu2)
.setLoadingDrawableId(R.mipmap.kungfu4)
.build();
}
示例11: MoreItemAdapter
import org.xutils.image.ImageOptions; //导入依赖的package包/类
public MoreItemAdapter(List<MoreModel.ListBean> data, Context context) {
if (data == null) {
data = new ArrayList<>();
}
this.data = data;
if (data.size() > 0) {
this.data.add(new MoreModel.ListBean());
}
this.inflater = LayoutInflater.from(context);
options = new ImageOptions.Builder()
.setFailureDrawableId(R.mipmap.kungfu1)
.setLoadingDrawableId(R.mipmap.kungfu6)
.build();
}
示例12: ParentAdapter
import org.xutils.image.ImageOptions; //导入依赖的package包/类
public ParentAdapter(Context context, List<ParentModel.ListBean> data) {
inflater = LayoutInflater.from(context);
if (data!=null) {
this.data = data;
}else {
this.data = new ArrayList<>();
}
options = new ImageOptions.Builder().setFailureDrawableId(R.mipmap.kungfu2).build();
}
示例13: HomeElvAdapter
import org.xutils.image.ImageOptions; //导入依赖的package包/类
public HomeElvAdapter(Context context, List<HomeModel> data) {
inflater = LayoutInflater.from(context);
if (data != null) {
this.data = data;
} else {
this.data = new ArrayList<>();
}
options = new ImageOptions.Builder().setFailureDrawableId(R.mipmap.kungfu2).build();
}
示例14: bind
import org.xutils.image.ImageOptions; //导入依赖的package包/类
void bind(ImageView view, String url, ImageOptions options);
示例15: loadDrawable
import org.xutils.image.ImageOptions; //导入依赖的package包/类
Callback.Cancelable loadDrawable(String url, ImageOptions options, Callback.CommonCallback<Drawable> callback);