当前位置: 首页>>代码示例>>Java>>正文


Java ImageView.layout方法代码示例

本文整理汇总了Java中android.widget.ImageView.layout方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.layout方法的具体用法?Java ImageView.layout怎么用?Java ImageView.layout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ImageView的用法示例。


在下文中一共展示了ImageView.layout方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clear_withNonOwningRequestManager_afterOwningManagerIsDestroyed_doesNotThrow

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * Tests #2262.
 */
@Test
public void clear_withNonOwningRequestManager_afterOwningManagerIsDestroyed_doesNotThrow() {
  // First destroy our Fragment/Activity RequestManager.
  requestManager.onDestroy();

  final ImageView imageView = new ImageView(context);
  imageView.measure(100, 100);
  imageView.layout(0, 0, 100, 100);
  // Then start a new load with our now destroyed RequestManager.
  concurrency.loadOnMainThread(requestManager.load(ResourceIds.raw.canonical), imageView);

  // Finally clear our new load with any RequestManager other than the one we used to start it.
  concurrency.runOnMainThread(new Runnable() {
    @Override
    public void run() {
      Glide.with(context).clear(imageView);
    }
  });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:RequestManagerTest.java

示例2: onLayout

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    if (null == imageInfos) {
        return;
    }
    int childCount = imageInfos.size();
    for (int i = 0; i < childCount; i++) {
        int columnNum = i % columnCount;
        int rowNum = i / columnCount;
        ImageView imageView = (ImageView) getChildAt(i);
        int left = (gridWidth + gridSpace) * columnNum + getPaddingLeft();
        int top = (gridHeight + gridSpace) * rowNum + getPaddingTop();
        int right = left + gridWidth;
        int bottom = top + gridHeight;
        imageView.layout(left, top, right, bottom);
        if (null != iLoadImageView) {
            iLoadImageView.displayImage(i, imageView, imageInfos.get(i).getThumbnailUrl());
        }
    }
}
 
开发者ID:penghuanliang,项目名称:Rxjava2.0Demo,代码行数:21,代码来源:NineGridImageView.java

示例3: onLayout

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onLayout(boolean change, int l, int t, int r, int b) {
    if (null == mImageInfo) {
        return;
    }
    int childCount = mImageInfo.size();
    for (int i = 0; i < childCount; i++) {
        ImageView childrenView = (ImageView) getChildAt(i);

        int rowNum = i / columnCount;
        int columnNum = i % columnCount;
        int left = (gridWidth + gridSpacing) * columnNum + getPaddingLeft();
        int top = (gridHeight + gridSpacing) * rowNum + getPaddingTop();
        int right = left + gridWidth;
        int bottom = top + gridHeight;
        childrenView.layout(left, top, right, bottom);
        //设置点击事件
        if (mImageLoader != null) {
            mImageLoader.onDisplayImage(getContext(), childrenView, mImageInfo.get(i).thumbnailUrl);
        }
    }
}
 
开发者ID:penghuanliang,项目名称:Rxjava2.0Demo,代码行数:23,代码来源:NineGridView.java

示例4: onLayout

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    if (mImageInfo == null) return;
    int childrenCount = mImageInfo.size();
    for (int i = 0; i < childrenCount; i++) {
        ImageView childrenView = (ImageView) getChildAt(i);
        if (mImageLoader != null) {
            mImageLoader.onDisplayImage(getContext(), childrenView, mImageInfo.get(i).thumbnailUrl);
        }
        int rowNum = i / columnCount;
        int columnNum = i % columnCount;
        int left = (gridWidth + gridSpacing) * columnNum + getPaddingLeft();
        int top = (gridHeight + gridSpacing) * rowNum + getPaddingTop();
        int right = left + gridWidth;
        int bottom = top + gridHeight;
        childrenView.layout(left, top, right, bottom);
    }
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:19,代码来源:NineGridView.java

示例5: layoutChildrenView

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * 布局 ImageView
 */
private void layoutChildrenView() {
    if (mAdapter == null) {
        return;
    }
    int showCount = getNeedShowCount(mAdapter.getItemCount());
    for (int i = 0; i < showCount; i++) {
        ImageView childrenView = (ImageView) getChildAt(i);
        if (mAdapter != null) {
            mAdapter.onDisplayImage(getContext(), childrenView, mAdapter.getItem(i));
        }
        int rowNum = i / mColumnCount;
        int columnNum = i % mColumnCount;
        int left = (mGridSize.w + mGap) * columnNum + getPaddingLeft();
        int top = (mGridSize.h + mGap) * rowNum + getPaddingTop();
        int right = left + mGridSize.w;
        int bottom = top + mGridSize.h;

        childrenView.layout(left, top, right, bottom);
    }
}
 
开发者ID:leobert-lan,项目名称:UiLib,代码行数:24,代码来源:NineImageSetView.java

示例6: setUp

import android.widget.ImageView; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
  Glide.tearDown();

  RobolectricPackageManager pm = RuntimeEnvironment.getRobolectricPackageManager();
  ApplicationInfo info =
      pm.getApplicationInfo(RuntimeEnvironment.application.getPackageName(), 0);
  info.metaData = new Bundle();
  info.metaData.putString(SetupModule.class.getName(), "GlideModule");

  // Ensure that target's size ready callback will be called synchronously.
  target = mock(Target.class);
  imageView = new ImageView(RuntimeEnvironment.application);
  imageView.setLayoutParams(new ViewGroup.LayoutParams(100, 100));
  imageView.layout(0, 0, 100, 100);
  doAnswer(new CallSizeReady()).when(target).getSize(isA(SizeReadyCallback.class));

  Handler bgHandler = mock(Handler.class);
  when(bgHandler.post(isA(Runnable.class))).thenAnswer(new Answer<Boolean>() {
    @Override
    public Boolean answer(InvocationOnMock invocation) throws Throwable {
      Runnable runnable = (Runnable) invocation.getArguments()[0];
      runnable.run();
      return true;
    }
  });

  Lifecycle lifecycle = mock(Lifecycle.class);
  RequestManagerTreeNode treeNode = mock(RequestManagerTreeNode.class);
  requestManager = new RequestManager(Glide.get(getContext()), lifecycle, treeNode);
  requestManager.resumeRequests();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:GlideTest.java

示例7: setUp

import android.widget.ImageView; //导入方法依赖的package包/类
@Before
public void setUp() {
  MockitoAnnotations.initMocks(this);
  context = InstrumentationRegistry.getTargetContext();
  imageView = new ImageView(context);
  imageView.measure(100, 100);
  imageView.layout(0, 0, 100, 100);

  // Some emulators only have a single resize thread, so waiting on a latch will block them
  // forever.
  Glide.init(context,
      new GlideBuilder().setSourceExecutor(GlideExecutor.newUnlimitedSourceExecutor()));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:RequestTest.java

示例8: layoutChildView

import android.widget.ImageView; //导入方法依赖的package包/类
private void layoutChildView() {
    int childrenCount = listData.size();

    int singleWidth = (totalWidth - gap * (3 - 1)) / 3;
    int singleHeight = singleWidth;

    //根据子view数量确定高度
    ViewGroup.LayoutParams params = getLayoutParams();
    params.height = singleHeight * rows + gap * (rows - 1);
    setLayoutParams(params);

    for (int i = 0; i < childrenCount; i++) {
        ImageView childrenView = (ImageView) getChildAt(i);
         final   String url = listData.get(i);
        final int viewPosition = i;
        childrenView.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent= new Intent(mContext.getApplicationContext(), ScanPhotoAcitivity.class);
                intent.putExtra("url",url);
                intent.putExtra("position", viewPosition+"");
                intent.putStringArrayListExtra("imagelist", mImageList);
                mContext.startActivity(intent);
            }
        });
        Picasso.with(getContext()).load(url).placeholder(R.mipmap.loading).error(R.mipmap.loading) .into(childrenView);
        int[] position = findPosition(i);
        int left = (singleWidth + gap) * position[1];
        int top = (singleHeight + gap) * position[0];
        int right = left + singleWidth;
        int bottom = top + singleHeight;

        childrenView.layout(left, top, right, bottom);
    }

}
 
开发者ID:scanflijinhuan,项目名称:MyFriendsComment,代码行数:37,代码来源:PhotoGroups.java

示例9: layoutImage

import android.widget.ImageView; //导入方法依赖的package包/类
void layoutImage(int i, int left, int top, int right, int bottom) {
    final ImageView view = imageViews[i];
    if (view.getLeft() == left && view.getTop() == top && view.getRight() == right
            && view.getBottom() == bottom) {
        return;
    }

    view.layout(left, top, right, bottom);
}
 
开发者ID:ihsanbal,项目名称:Wiv,代码行数:10,代码来源:MediaView.java

示例10: setUp

import android.widget.ImageView; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
  MockitoAnnotations.initMocks(this);
  context = RuntimeEnvironment.application;

   // Run all tasks on the main thread so they complete synchronously.
  GlideExecutor executor = MockGlideExecutor.newMainThreadExecutor();
  when(diskCacheFactory.build()).thenReturn(diskCache);
  Glide.init(
      context,
      new GlideBuilder()
          .setMemoryCache(memoryCache)
          .setDiskCache(diskCacheFactory)
          .setSourceExecutor(executor)
          .setDiskCacheExecutor(executor));
  Registry registry = Glide.get(context).getRegistry();
  registerMockModelLoader(
      GlideUrl.class, InputStream.class, new ByteArrayInputStream(new byte[0]), registry);
  registerMockModelLoader(
      File.class, InputStream.class, new ByteArrayInputStream(new byte[0]), registry);
  registerMockModelLoader(
      File.class, ParcelFileDescriptor.class, mock(ParcelFileDescriptor.class), registry);
  registerMockModelLoader(File.class, ByteBuffer.class, ByteBuffer.allocate(10), registry);

  // Ensure that target's size ready callback will be called synchronously.
  imageView = new ImageView(context);
  imageView.setLayoutParams(new ViewGroup.LayoutParams(100, 100));
  imageView.layout(0, 0, 100, 100);
  doAnswer(new CallSizeReady()).when(target).getSize(isA(SizeReadyCallback.class));

  when(bgHandler.post(isA(Runnable.class))).thenAnswer(new Answer<Boolean>() {
    @Override
    public Boolean answer(InvocationOnMock invocation) throws Throwable {
      Runnable runnable = (Runnable) invocation.getArguments()[0];
      runnable.run();
      return true;
    }
  });

  requestManager = new RequestManager(Glide.get(context), lifecycle, treeNode, context);
  requestManager.resumeRequests();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:43,代码来源:GlideTest.java


注:本文中的android.widget.ImageView.layout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。