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


Java View.setEnabled方法代码示例

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


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

示例1: getView

import android.view.View; //导入方法依赖的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: onPreTransform

import android.view.View; //导入方法依赖的package包/类
protected void onPreTransform(View page, float position) {
    final float width = page.getWidth();

    page.setRotationX(0);
    page.setRotationY(0);
    page.setRotation(0);
    page.setScaleX(1);
    page.setScaleY(1);
    page.setPivotX(0);
    page.setPivotY(0);
    page.setTranslationY(0);
    page.setTranslationX(isPagingEnabled() ? 0f : -width * position);

    if (hideOffscreenPages()) {
        page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f);
        page.setEnabled(false);
    } else {
        page.setEnabled(true);
        page.setAlpha(1f);
    }
}
 
开发者ID:ahmet12,项目名称:easlider,代码行数:22,代码来源:BaseTransformer.java

示例3: invalidateInputMinMaxIndicator

import android.view.View; //导入方法依赖的package包/类
protected void invalidateInputMinMaxIndicator(int currentLength, boolean emptyDisabled) {
    if (inputMinMax != null) {
        if (builder.inputMaxLength > 0) {
            inputMinMax.setText(String.format(Locale.getDefault(), "%d/%d", currentLength, builder.inputMaxLength));
            inputMinMax.setVisibility(View.VISIBLE);
        } else inputMinMax.setVisibility(View.GONE);
        final boolean isDisabled = (emptyDisabled && currentLength == 0) ||
                (builder.inputMaxLength > 0 && currentLength > builder.inputMaxLength) ||
                currentLength < builder.inputMinLength;
        final int colorText = isDisabled ? builder.inputRangeErrorColor : builder.contentColor;
        final int colorWidget = isDisabled ? builder.inputRangeErrorColor : builder.widgetColor;
        if (builder.inputMaxLength > 0)
            inputMinMax.setTextColor(colorText);
        MDTintHelper.setTint(input, colorWidget);
        final View positiveAb = getActionButton(DialogAction.POSITIVE);
        positiveAb.setEnabled(!isDisabled);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:MaterialDialog.java

示例4: onPreTransform

import android.view.View; //导入方法依赖的package包/类
/**
 * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}.
 * <p>
 * The default implementation attempts to reset all view properties. This is useful when toggling transforms that do
 * not modify the same page properties. For instance changing from a transformation that applies rotation to a
 * transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied
 * alpha.
 * 
 * @param page
 *            Apply the transformation to this page
 * @param position
 *            Position of page relative to the current front-and-center position of the pager. 0 is front and
 *            center. 1 is one full page position to the right, and -1 is one page position to the left.
 */
protected void onPreTransform(View page, float position) {
	final float width = page.getWidth();

	page.setRotationX(0);
	page.setRotationY(0);
	page.setRotation(0);
	page.setScaleX(1);
	page.setScaleY(1);
	page.setPivotX(0);
	page.setPivotY(0);
	page.setTranslationY(0);
	page.setTranslationX(isPagingEnabled() ? 0f : -width * position);

	if (hideOffscreenPages()) {
		page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f);
		page.setEnabled(false);
	} else {
		page.setEnabled(true);
		page.setAlpha(1f);
	}
}
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:36,代码来源:ABaseTransformer.java

示例5: setupStandardMenuItemViewHolder

import android.view.View; //导入方法依赖的package包/类
private void setupStandardMenuItemViewHolder(StandardMenuItemViewHolder holder,
        View convertView, final MenuItem item) {
    // Set up the icon.
    Drawable icon = item.getIcon();
    holder.image.setImageDrawable(icon);
    holder.image.setVisibility(icon == null ? View.GONE : View.VISIBLE);
    holder.image.setChecked(item.isChecked());
    holder.text.setText(item.getTitle());
    holder.text.setContentDescription(item.getTitleCondensed());

    boolean isEnabled = item.isEnabled();
    // Set the text color (using a color state list).
    holder.text.setEnabled(isEnabled);
    // This will ensure that the item is not highlighted when selected.
    convertView.setEnabled(isEnabled);

    convertView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            mAppMenu.onItemClick(item);
        }
    });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:24,代码来源:AppMenuAdapter.java

示例6: startDownload

import android.view.View; //导入方法依赖的package包/类
private void startDownload(View v, boolean allowDownloadOverMetered) {
    v.setEnabled(false);

    List<String> files = FontManager.getFiles(getData(), v.getContext(), true);
    List<Long> ids = FontManager.download(getData(), files, v.getContext(), allowDownloadOverMetered);

    mBroadcastReceiver = new DownloadBroadcastReceiver(ids);

    FontViewHolder.this.itemView.getContext().registerReceiver(
            mBroadcastReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
}
 
开发者ID:RikkaApps,项目名称:FontProvider,代码行数:12,代码来源:FontViewHolder.java

示例7: onPreExecute

import android.view.View; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void onPreExecute() {
    //Disable action view
    for (View b : this.actionViews) {
        b.setEnabled(false);
    }
}
 
开发者ID:righettod,项目名称:access-brute-forcer,代码行数:11,代码来源:CredentialProbingTask.java

示例8: setEnabledRecursively

import android.view.View; //导入方法依赖的package包/类
private void setEnabledRecursively(@NonNull final View view, final boolean enabled) {
    view.setEnabled(enabled);

    if (view instanceof ViewGroup) {
        final ViewGroup viewGroup = (ViewGroup) view;
        final int childCount = viewGroup.getChildCount();
        for (int index = 0; index < childCount; index++) {
            final View child = viewGroup.getChildAt(index);
            setEnabledRecursively(child, enabled);
        }
    }
}
 
开发者ID:GlobusLTD,项目名称:recyclerview-android,代码行数:13,代码来源:RecursiveEnableBehavior.java

示例9: clickSave

import android.view.View; //导入方法依赖的package包/类
public void clickSave(View v) {
    if (mSlate.isEmpty()) return;

    v.setEnabled(false);
    final String filename = System.currentTimeMillis() + ".png";
    saveDrawing(filename);
    v.setEnabled(true);
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:9,代码来源:MarkersActivity.java

示例10: getView

import android.view.View; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	if (position < mCursorCount) {
		return getDocumentView(position, convertView, parent);
	} else {
		position -= mCursorCount;
		convertView = mFooters.get(position).getView(convertView, parent);
		// Only the view itself is disabled; contents inside shouldn't
		// be dimmed.
		convertView.setEnabled(false);
		return convertView;
	}
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:14,代码来源:DirectoryFragment.java

示例11: setEnabled

import android.view.View; //导入方法依赖的package包/类
@Override
public void setEnabled(boolean enabled) {
    int childCount = getChildCount();

    for (int i = 0; i < childCount; i++) {
        View child = getChildAt(i);
        child.setEnabled(enabled);
    }
}
 
开发者ID:liuguangli,项目名称:VerificationCodeInput,代码行数:10,代码来源:VerificationCodeInput.java

示例12: setEnabled

import android.view.View; //导入方法依赖的package包/类
@Override
public void setEnabled(boolean enabled) {
    if (isEnabled() == enabled)
        return;

    for (View v : new View[] { mButtonSearch, mTextSearch, mButtonClear })
        v.setEnabled(enabled);
    super.setEnabled(enabled);
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:10,代码来源:AfcSearchView.java

示例13: revealOff

import android.view.View; //导入方法依赖的package包/类
@Override
final void revealOff(final View fab, final View transformView, final RevealCallback callback) {
    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(
            transformView,
            getCenterX(fab),
            getCenterY(fab),
            (float) Math.hypot(transformView.getWidth(), transformView.getHeight()) / 2,
            fab.getWidth() / 2);
    animator.setInterpolator(REVEAL_INTERPOLATOR);
    animator.addListener(new SupportAnimator.AnimatorListener() {
        @Override
        public void onAnimationStart() {
            callback.onRevealStart();
        }

        @Override
        public void onAnimationEnd() {
            transformView.setVisibility(View.INVISIBLE);
            callback.onRevealEnd();
        }

        @Override
        public void onAnimationCancel() {
            //
        }

        @Override
        public void onAnimationRepeat() {
            //
        }
    });
    if (transformView.getVisibility() == View.VISIBLE) {
        animator.setDuration((int) getRevealAnimationDuration());
        animator.start();
        transformView.setEnabled(true);
    }
}
 
开发者ID:SimonCherryGZ,项目名称:JewelryUI,代码行数:38,代码来源:FabAnimatorPreL.java

示例14: setViewEnabled

import android.view.View; //导入方法依赖的package包/类
private void setViewEnabled(ViewGroup layout, boolean enabled) {
    layout.setEnabled(enabled);
    for (int i = 0; i < layout.getChildCount(); i++) {
        View child = layout.getChildAt(i);
        if (child instanceof ViewGroup) {
            setViewEnabled((ViewGroup) child, enabled);
        } else {
            child.setEnabled(enabled);
        }
    }
}
 
开发者ID:Codigami,项目名称:CFAlertDialog,代码行数:12,代码来源:CFAlertDialog.java

示例15: enabled

import android.view.View; //导入方法依赖的package包/类
private void enabled(View view, Object object) {
    view.setEnabled(transformToBoolean(object));
}
 
开发者ID:nicolkill,项目名称:SuperRecyclerView,代码行数:4,代码来源:SuperRecyclerAdapter.java


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