本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
});
}
示例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));
}
示例7: onPreExecute
import android.view.View; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void onPreExecute() {
//Disable action view
for (View b : this.actionViews) {
b.setEnabled(false);
}
}
示例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);
}
}
}
示例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);
}
示例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;
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
}
示例15: enabled
import android.view.View; //导入方法依赖的package包/类
private void enabled(View view, Object object) {
view.setEnabled(transformToBoolean(object));
}