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


Java ImageView.setImageLevel方法代码示例

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


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

示例1: getView

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
	View view = convertView;
	if (view == null) {
		final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
		view = inflater.inflate(R.layout.feature_uart_button, parent, false);
	}
	view.setEnabled(isEnabled(position));
	view.setActivated(mEditMode);

	// Update image
	final Command command = (Command) getItem(position);
	final ImageView image = (ImageView) view;
	final boolean active = command != null && command.isActive();
	if (active) {
		final int icon = command.getIconIndex();
		image.setImageResource(R.drawable.uart_button);
		image.setImageLevel(icon);
	} else
		image.setImageDrawable(null);

	return view;
}
 
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:24,代码来源:UARTButtonAdapter.java

示例2: onBindView

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onBindView(View view) {
    TextView label = (TextView) view.findViewById(R.id.suw_items_title);
    label.setText(getTitle());

    TextView summaryView = (TextView) view.findViewById(R.id.suw_items_summary);
    CharSequence summary = getSummary();
    if (summary != null && summary.length() > 0) {
        summaryView.setText(summary);
        summaryView.setVisibility(View.VISIBLE);
    } else {
        summaryView.setVisibility(View.GONE);
    }

    final View iconContainer = view.findViewById(R.id.suw_items_icon_container);
    final Drawable icon = getIcon();
    if (icon != null) {
        final ImageView iconView = (ImageView) view.findViewById(R.id.suw_items_icon);
        // Set the image drawable to null before setting the state and level to avoid affecting
        // any recycled drawable in the ImageView
        iconView.setImageDrawable(null);
        iconView.setImageState(icon.getState(), false /* merge */);
        iconView.setImageLevel(icon.getLevel());
        iconView.setImageDrawable(icon);
        iconContainer.setVisibility(View.VISIBLE);
    } else {
        iconContainer.setVisibility(View.GONE);
    }

    view.setId(getViewId());
}
 
开发者ID:Trumeet,项目名称:SetupWizardLibCompat,代码行数:32,代码来源:Item.java

示例3: getView

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
	View view = convertView;
	if (view == null) {
		view = LayoutInflater.from(getActivity()).inflate(R.layout.feature_uart_dialog_edit_icon, parent, false);
	}
	final ImageView image = (ImageView) view;
	image.setImageLevel(position);
	image.setActivated(position == mActiveIcon && mActiveCheckBox.isChecked());
	return view;
}
 
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:12,代码来源:UARTEditDialog.java

示例4: scrollToTab

import android.widget.ImageView; //导入方法依赖的package包/类
private void scrollToTab(int tabIndex, float positionOffset) {

        final int tabStripChildCount = tabStrip.getChildCount();
        if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) {
            return;
        }

        LinearLayout selectedTab = (LinearLayout) getTabAt(tabIndex);

        if (0f <= positionOffset && positionOffset < 1f) {
            if(!tabLayoutState){
                ImageView imageView = (ImageView) selectedTab.getChildAt(0);
                ((RevealDrawable)imageView.getDrawable()).setOrientation(RevealDrawable.VERTICAL);
                imageView.setImageLevel((int) (positionOffset * 5000 + 5000));
            }
            if(flag){
                ChangeTextView textView = (ChangeTextView) selectedTab.getChildAt(1);
                textView.setLevel((int) (positionOffset * 5000 + 5000));
            }
        }

        if(!(tabIndex + 1 >= tabStripChildCount)){
            LinearLayout tab = (LinearLayout) getTabAt(tabIndex + 1);

            if(!tabLayoutState){
                ImageView img = (ImageView) tab.getChildAt(0);
                ((RevealDrawable)img.getDrawable()).setOrientation(RevealDrawable.VERTICAL);
                img.setImageLevel((int) (positionOffset * 5000));
            }
            if(flag){
                ChangeTextView text = (ChangeTextView) tab.getChildAt(1);
                text.setLevel((int) (positionOffset * 5000));
            }
        }

        int titleOffset = tabViewHeight * 2;
        int extraOffset = (int) (positionOffset * selectedTab.getHeight());

        int y = (tabIndex > 0 || positionOffset > 0) ? -titleOffset : 0;
        int start = selectedTab.getTop();
        y += start + extraOffset;

        scrollTo(0, y);
    }
 
开发者ID:simplezhli,项目名称:ChangeTabLayout,代码行数:45,代码来源:ChangeTabLayout.java

示例5: setPageScrolled

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * 水平VIewPager控制
 */
public void setPageScrolled(int p, int position, float positionOffset) {
    if (page != p){
        return;
    }
    //竖屏状态下`ViewPage`的`onPageScrolled`监听不正常修复(统一数据)
    if (positionOffset > 0.99 && positionOffset < 1){
        positionOffset = 0;
        position = position + 1;
    }else if (positionOffset < 0.01 && positionOffset > 0.00001){
        positionOffset = 0;
    }

    if (position - lastPosition[page] > 0) {
        if (lastPosition[page] != ARRAY_INITIAL_VALUE){
            tabLayoutState = false; //每次向左滑动结束时,进入判断,菜单关闭状态
            tabLayoutIsClick = true;
        }
    }else if(position - lastPosition[page] < 0){
        if(lastValue[page] - positionOffset < 0){
            //向左滑动时,不操作。
            return;
        }
    }

    lastPosition[page] = position;
    lastValue[page] = positionOffset;

    if(positionOffset == 0){
        return;
    }

    if(tabLayoutState){ //防止重复收起
        final int tabStripChildCount = tabStrip.getChildCount();
        if (tabStripChildCount == 0 || page < 0 || page >= tabStripChildCount) {
            return;
        }

        LinearLayout selectedTab = (LinearLayout) getTabAt(page);
        ImageView imageView = (ImageView) selectedTab.getChildAt(0);
        ((RevealDrawable)imageView.getDrawable()).setOrientation(RevealDrawable.HORIZONTAL);
        if (0f < positionOffset && positionOffset <= 1f) {
            imageView.setImageLevel((int) ((1 - positionOffset) * 5000 + 5000));
        }

        for (int i = 0, size = tabStrip.getChildCount(); i < size; i++) {
            ChangeTextView textView = (ChangeTextView) ((LinearLayout) tabStrip.getChildAt(i)).getChildAt(1);
            if (0f < positionOffset && positionOffset <= 1f) {
                textView.setAlpha((1 - positionOffset));
                if(positionOffset > 0.9f){
                    textView.setVisibility(INVISIBLE);
                    tabLayoutIsClick = false; //防止同时点击,导致状态混乱
                }else{
                    textView.setVisibility(VISIBLE);
                    tabLayoutIsClick = true;
                }
            }
        }

        if (positionOffset > 0.98){
            positionOffset = 1;
        }
        tabStrip.onViewPagerPageChanged(positionOffset);
    }
}
 
开发者ID:simplezhli,项目名称:ChangeTabLayout,代码行数:68,代码来源:ChangeTabLayout.java


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