當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。