android.widget.ImageView#setMinimumHeight ( )源码实例Demo

下面列出了android.widget.ImageView#setMinimumHeight ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Yahala-Messenger   文件: ImageFetcher.java
/**
 * Same as download but the image is always downloaded and the cache is not
 * used. Kept private at the moment as its interest is not clear.
 */
private void forceDownload(Integer position, ImageView imageView) {
    if (position == null) {
        imageView.setImageDrawable(null);
        return;
    }

    if (cancelPotentialDownload(position, imageView)) {
        BitmapFetcherTask task = new BitmapFetcherTask(imageView.getContext(), imageView);
        DownloadedDrawable downloadedDrawable = new DownloadedDrawable(imageView.getContext(), task, origId);
        imageView.setImageDrawable(downloadedDrawable);
        imageView.setMinimumHeight(colWidth);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            task.executeOnExecutor(executor, position);
        } else {
            try {
                task.execute(position);
            } catch (RejectedExecutionException e) {
                Log.d("ImageFetcher", "Not downloading: " + e.getMessage());
                // Oh :(
            }
        }

    }
}
 
源代码2 项目: WifiChat   文件: MultiListView.java
/**
 * 添加下拉刷新的HeadView
 * 
 * @date 2015年2月14日 上午11:17
 * @change hillfly
 */
private void addHeadView() {
    mHeadView = (LinearLayout) mInflater.inflate(R.layout.listview_multilistview_head, null);

    mArrowImageView = (ImageView) mHeadView.findViewById(R.id.head_arrowImageView);
    mArrowImageView.setMinimumWidth(70);
    mArrowImageView.setMinimumHeight(50);
    mProgressBar = (ProgressBar) mHeadView.findViewById(R.id.head_progressBar);
    mTipsTextView = (TextView) mHeadView.findViewById(R.id.head_tipsTextView);
    mLastUpdatedTextView = (TextView) mHeadView.findViewById(R.id.head_lastUpdatedTextView);

    measureView(mHeadView);
    mHeadViewHeight = mHeadView.getMeasuredHeight();

    mHeadView.setPadding(0, -1 * mHeadViewHeight, 0, 0);
    mHeadView.invalidate();

    addHeaderView(mHeadView, null, false);

    mHeadState = DONE;
}
 
源代码3 项目: GravityBox   文件: PieController.java
private PieItem constructItem(int width, ButtonType type, Drawable image, int minimumImageSize) {
    ImageView view = new ImageView(mContext);
    view.setImageDrawable(image);
    view.setMinimumWidth(minimumImageSize);
    view.setMinimumHeight(minimumImageSize);
    LayoutParams lp = new LayoutParams(minimumImageSize, minimumImageSize);
    view.setLayoutParams(lp);
    PieItem item = new PieItem(mContext, mGbContext, mPieContainer, 0, width, type, view, mColorInfo);
    item.setOnClickListener(this);
    item.setOnLongPressListener(mLongPressHandler);
    return item;
}
 
源代码4 项目: AndroidStudyDemo   文件: CustomListView.java
/**
 * 添加下拉刷新的HeadView 
 * @date 2013-11-11 下午9:48:26
 * @change JohnWatson
 * @version 1.0
 */
private void addHeadView() {
	mHeadView = (LinearLayout) mInflater.inflate(R.layout.head, null);

	mArrowImageView = (ImageView) mHeadView
			.findViewById(R.id.head_arrowImageView);
	mArrowImageView.setMinimumWidth(70);
	mArrowImageView.setMinimumHeight(50);
	mProgressBar = (ProgressBar) mHeadView
			.findViewById(R.id.head_progressBar);
	mTipsTextView = (TextView) mHeadView.findViewById(
			R.id.head_tipsTextView);
	mLastUpdatedTextView = (TextView) mHeadView
			.findViewById(R.id.head_lastUpdatedTextView);

	measureView(mHeadView);
	mHeadViewHeight = mHeadView.getMeasuredHeight();
	mHeadViewWidth = mHeadView.getMeasuredWidth();
	
	mHeadView.setPadding(0, -1 * mHeadViewHeight, 0, 0);
	mHeadView.invalidate();

	Log.v("size", "width:" + mHeadViewWidth + " height:"
			+ mHeadViewHeight);

	addHeaderView(mHeadView, null, false);
	
	mHeadState = DONE;
}
 
源代码5 项目: SlidePager   文件: SlideChartView.java
/**
 * Init the {@link android.graphics.Color} of the {@link #mChartBarList}
 */
private void initBarColorsAndSize() {
    for (ImageView imageView : mChartBarList) {
        imageView.setBackgroundColor(mChartBarColor);
        if (imageView.getId() != R.id.progress_bottom_axis) {
            imageView.setMinimumHeight((int) (mChartBarSize / 2.0f));
        }
    }
}
 
源代码6 项目: zhangshangwuda   文件: PullToRefreshListView.java
/***
 * 初始化头部
 */
private void initHeadView() {

	inflater = LayoutInflater.from(context);
	mHeadView = (LinearLayout) inflater.inflate(
			R.layout.pulldownlistview_head, null);

	mArrowImageView = (ImageView) mHeadView
			.findViewById(R.id.pulldownlistview_head_arrow_ImageView);
	mArrowImageView.setMinimumWidth(50);
	mArrowImageView.setMinimumHeight(50);
	mHeadProgressBar = (ProgressBar) mHeadView
			.findViewById(R.id.pulldownlistview_head_progressBar);
	mRefreshTextview = (TextView) mHeadView
			.findViewById(R.id.pulldownlistview_head_tips_TextView);
	mLastUpdateTextView = (TextView) mHeadView
			.findViewById(R.id.pulldownlistview_head_lastUpdated_TextView);

	headContentOriginalTopPadding = mHeadView.getPaddingTop();

	measureView(mHeadView);
	headContentHeight = mHeadView.getMeasuredHeight();
	headContentWidth = mHeadView.getMeasuredWidth();

	mHeadView.setPadding(mHeadView.getPaddingLeft(),
			-1 * headContentHeight, mHeadView.getPaddingRight(),
			mHeadView.getPaddingBottom());
	mHeadView.invalidate();

	// LOG.D("初始高度:"+headContentHeight);
	// LOG.D("初始TopPad:"+headContentOriginalTopPadding);

	addHeaderView(mHeadView);
	setOnScrollListener(this);
}
 
源代码7 项目: codeexamples-android   文件: ImageDownloader.java
/**
 * Same as download but the image is always downloaded and the cache is not
 * used. Kept private at the moment as its interest is not clear.
 */
private void forceDownload(String url, ImageView imageView) {
	// State sanity: url is guaranteed to never be null in
	// DownloadedDrawable and cache keys.
	if (url == null) {
		imageView.setImageDrawable(null);
		return;
	}

	BitmapDownloaderTask task = new BitmapDownloaderTask(imageView);
	DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task);
	imageView.setImageDrawable(downloadedDrawable);
	imageView.setMinimumHeight(156);
	task.execute(url);
}
 
源代码8 项目: LazyRecyclerAdapter   文件: List2Fragment.java
private void initView() {
    //瀑布流管理器
    staggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
    //设置瀑布流管理器
    xRecycler.setLayoutManager(staggeredGridLayoutManager);
    //添加分割线,注意位置是会从下拉那个Item的实际位置开始的,所以如果支持下拉需要屏蔽下拉和HeaderView
    xRecycler.addItemDecoration(new DividerItemDecoration(dip2px(getActivity(), 10), DividerItemDecoration.GRID, 2));

    //是否屏蔽下拉
    //xRecycler.setPullRefreshEnabled(false);
    //上拉加载更多样式,也可以设置下拉
    xRecycler.setLoadingMoreProgressStyle(ProgressStyle.SysProgress);
    //设置管理器,关联布局与holder类名,不同id可以管理一个holder
    CommonRecyclerManager commonRecyclerManager = new CommonRecyclerManager();
    commonRecyclerManager.addType(ImageHolder.ID, ImageHolder.class.getName());
    commonRecyclerManager.addType(TextHolder.ID, TextHolder.class.getName());
    commonRecyclerManager.addType(ClickHolder.ID, ClickHolder.class.getName());
    //初始化通用管理器
    commonRecyclerAdapter = new CommonRecyclerAdapter(getActivity(), commonRecyclerManager, dataList);
    xRecycler.setAdapter(commonRecyclerAdapter);

    ImageView imageView = new ImageView(getActivity());
    imageView.setImageResource(R.drawable.xxx1);
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setMinimumHeight(dip2px(getActivity(), 100));
    //添加头部
    xRecycler.addHeaderView(imageView);
    //本身也支持设置空局部
    //xRecycler.setEmptyView();
    xRecycler.setLoadingListener(new XRecyclerView.LoadingListener() {
        @Override
        public void onRefresh() {
            xRecycler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    refresh();
                }
            }, 2000);
        }

        @Override
        public void onLoadMore() {
            xRecycler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    loadMore();
                }
            }, 1000);
        }
    });

    commonRecyclerAdapter.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(Context context, int position) {
            //需要减去你的header和刷新的view的数量
            Toast.makeText(getActivity(), "点击了!! " + (position - 2), Toast.LENGTH_SHORT).show();
        }
    });
}
 
源代码9 项目: wakao-app   文件: PullToRefreshListView.java
private void init(Context context) {   
	//设置滑动效果
    animation = new RotateAnimation(0, -180,  
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,  
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);  
    animation.setInterpolator(new LinearInterpolator());  
    animation.setDuration(100);  
    animation.setFillAfter(true);  
  
    reverseAnimation = new RotateAnimation(-180, 0,  
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,  
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);  
    reverseAnimation.setInterpolator(new LinearInterpolator());  
    reverseAnimation.setDuration(100);  
    reverseAnimation.setFillAfter(true);  
    
    inflater = LayoutInflater.from(context);  
    headView = (LinearLayout) inflater.inflate(R.layout.pull_to_refresh_head, null);  
  
    arrowImageView = (ImageView) headView.findViewById(R.id.head_arrowImageView);  
    arrowImageView.setMinimumWidth(50);  
    arrowImageView.setMinimumHeight(50);  
    progressBar = (ProgressBar) headView.findViewById(R.id.head_progressBar);  
    tipsTextview = (TextView) headView.findViewById(R.id.head_tipsTextView);  
    lastUpdatedTextView = (TextView) headView.findViewById(R.id.head_lastUpdatedTextView);  
    
    headContentOriginalTopPadding = headView.getPaddingTop();  
    
    measureView(headView);  
    headContentHeight = headView.getMeasuredHeight();  
    headContentWidth = headView.getMeasuredWidth(); 
    
    headView.setPadding(headView.getPaddingLeft(), -1 * headContentHeight, headView.getPaddingRight(), headView.getPaddingBottom());  
    headView.invalidate();  

    //System.out.println("初始高度:"+headContentHeight); 
    //System.out.println("初始TopPad:"+headContentOriginalTopPadding);
    
    addHeaderView(headView);        
    setOnScrollListener(this); 
}
 
源代码10 项目: YiBo   文件: PullToRefreshListView.java
private void init(Context context) {
    // Load all of the animations we need in code rather than through XML
    mFlipAnimation = new RotateAnimation(0, 180,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    mFlipAnimation.setInterpolator(new LinearInterpolator());
    mFlipAnimation.setDuration(250);
    mFlipAnimation.setFillAfter(true);
    mReverseFlipAnimation = new RotateAnimation(180, 360,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    mReverseFlipAnimation.setInterpolator(new LinearInterpolator());
    mReverseFlipAnimation.setDuration(250);
    mReverseFlipAnimation.setFillAfter(true);

    LayoutInflater mInflater = (LayoutInflater) context.getSystemService(
            Context.LAYOUT_INFLATER_SERVICE);
    mRefreshView = (LinearLayout) mInflater.inflate(
            R.layout.widget_pull_to_refresh_header, null);

    mRefreshViewText =
        (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_text);
    mRefreshViewImage =
        (ImageView) mRefreshView.findViewById(R.id.pull_to_refresh_image);
    mRefreshViewProgress =
        (ProgressBar) mRefreshView.findViewById(R.id.pull_to_refresh_progress);
    mRefreshViewLastUpdated =
        (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_updated_at);

    Theme theme = new Theme(context);
    mRefreshViewText.setTextColor(theme.getColor("content"));
    
    mRefreshViewImage.setMinimumHeight(50);
    mRefreshView.setOnClickListener(new OnClickRefreshListener());
    mRefreshOriginalTopPadding = mRefreshView.getPaddingTop();

    mRefreshState = TAP_TO_REFRESH;

    addHeaderView(mRefreshView);

    super.setOnScrollListener(this);

    measureView(mRefreshView);
    mRefreshViewHeight = mRefreshView.getMeasuredHeight();
}