Java Code Examples for android.widget.ImageView#setMinimumHeight()

The following examples show how to use android.widget.ImageView#setMinimumHeight() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageFetcher.java    From Yahala-Messenger with MIT License 6 votes vote down vote up
/**
 * 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 :(
            }
        }

    }
}
 
Example 2
Source File: MultiListView.java    From WifiChat with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 添加下拉刷新的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;
}
 
Example 3
Source File: PieController.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 4
Source File: CustomListView.java    From AndroidStudyDemo with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 添加下拉刷新的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;
}
 
Example 5
Source File: SlideChartView.java    From SlidePager with MIT License 5 votes vote down vote up
/**
 * 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));
        }
    }
}
 
Example 6
Source File: PullToRefreshListView.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
/***
 * 初始化头部
 */
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);
}
 
Example 7
Source File: ImageDownloader.java    From codeexamples-android with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 8
Source File: List2Fragment.java    From LazyRecyclerAdapter with MIT License 4 votes vote down vote up
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();
        }
    });
}
 
Example 9
Source File: PullToRefreshListView.java    From wakao-app with MIT License 4 votes vote down vote up
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); 
}
 
Example 10
Source File: PullToRefreshListView.java    From YiBo with Apache License 2.0 4 votes vote down vote up
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();
}