本文整理汇总了Java中android.view.View.VISIBLE属性的典型用法代码示例。如果您正苦于以下问题:Java View.VISIBLE属性的具体用法?Java View.VISIBLE怎么用?Java View.VISIBLE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.View
的用法示例。
在下文中一共展示了View.VISIBLE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMeasuredViewForAlertDialog
public static View getMeasuredViewForAlertDialog(LayoutInflater inflater, int itemId, int btnCount, String content, int width, boolean hasEditText) {
View view = inflater.inflate(itemId, null);
if (btnCount == 1) {
view.findViewById(R.id.btnCancel).setVisibility(View.GONE);
} else if (btnCount == 3) {
view.findViewById(R.id.btnCancel).setVisibility(View.VISIBLE);
view.findViewById(R.id.btnExit).setVisibility(View.VISIBLE);
} else {
view.findViewById(R.id.btnCancel).setVisibility(View.VISIBLE);
}
((TextView) view.findViewById(R.id.txtContent)).setText(content);
int visibility = hasEditText ? View.VISIBLE : View.GONE;
view.findViewById(R.id.edtLibName).setVisibility(visibility);
view.measure(View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(view.getHeight(), View.MeasureSpec.UNSPECIFIED));
return view;
}
示例2: onKeyEvent
public boolean onKeyEvent(int keyCode, KeyEvent event) {
try {
int resId = ResHelper.getIdRes(activity, "llSearch");
if (keyCode == KeyEvent.KEYCODE_BACK
&& event.getAction() == KeyEvent.ACTION_DOWN
&& activity.findViewById(resId).getVisibility() == View.VISIBLE) {
activity.findViewById(resId).setVisibility(View.GONE);
resId = ResHelper.getIdRes(activity, "llTitle");
activity.findViewById(resId).setVisibility(View.VISIBLE);
etSearch.setText("");
return true;
}
} catch (Throwable e) {
SMSLog.getInstance().w(e);
}
return super.onKeyEvent(keyCode, event);
}
示例3: onNestedPreScroll
@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, View child,
View target, int dx, int dy, int[] consumed) {
if (dy > 0 && sinceDirectionChange < 0 || dy < 0 && sinceDirectionChange > 0) {
child.animate().cancel();
sinceDirectionChange = 0;
}
sinceDirectionChange += dy;
int visibility = child.getVisibility();
if (sinceDirectionChange > child.getHeight() && visibility == View.VISIBLE) {
hide(child);
} else {
if (sinceDirectionChange < 0 && (visibility == View.GONE || visibility == View
.INVISIBLE)) {
show(child);
}
}
}
示例4: getSelectedColor
@ColorInt private int getSelectedColor() {
if (colorChooserCustomFrame != null &&
colorChooserCustomFrame.getVisibility() == View.VISIBLE) {
return selectedCustomColor;
}
int color = 0;
if (subIndex() > -1)
color = mColorsSub[topIndex()][subIndex()];
else if (topIndex() > -1)
color = mColorsTop[topIndex()];
if (color == 0) {
int fallback = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
fallback = DialogUtils.resolveColor(getActivity(), android.R.attr.colorAccent);
color = DialogUtils.resolveColor(getActivity(), R.attr.colorAccent, fallback);
}
return color;
}
示例5: onNestedScroll
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child,
View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed,
dyUnconsumed);
if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
/**
* Called when a FloatingActionButton has been hidden
*
* @param fab the FloatingActionButton that was hidden.
*/
@Override
public void onHidden(FloatingActionButton fab) {
super.onShown(fab);
fab.setVisibility(View.INVISIBLE);
}
});
} else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
child.show();
}
}
示例6: setLv1Item
private void setLv1Item(NewConditionItem item) {
if (item == null) {
mPrimaryList.setVisibility(View.GONE);
setLv2Item(null);
return;
}
if (mPrimaryList.getVisibility() != View.VISIBLE) {
mPrimaryList.setVisibility(View.VISIBLE);
}
mPrimaryAdapter.setList(item.subItems);
mPrimaryAdapter.notifyDataSetChanged();
for (int i = 0; i < item.subItems.size(); ++i) {
NewConditionItem subItem = item.subItems.get(i);
if (subItem.selected) {
setLv2Item(subItem);
if (mSetting) {
checkSelectedItemVisibility(mPrimaryList, i);
}
return;
}
}
setLv2Item(null);
}
示例7: onPageFinishedLoading
@Override
public void onPageFinishedLoading(String url) {
LOG.d(TAG, "onPageFinished(" + url + ")");
clearLoadTimeoutTimer();
// Broadcast message that page has loaded
pluginManager.postMessage("onPageFinished", url);
// Make app visible after 2 sec in case there was a JS error and Cordova JS never initialized correctly
if (engine.getView().getVisibility() != View.VISIBLE) {
Thread t = new Thread(new Runnable() {
public void run() {
try {
Thread.sleep(2000);
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
pluginManager.postMessage("spinner", "stop");
}
});
} catch (InterruptedException e) {
}
}
});
t.start();
}
// Shutdown if blank loaded
if (url.equals("about:blank")) {
pluginManager.postMessage("exit", null);
}
}
示例8: showExpirationDateInputsInputs
private void showExpirationDateInputsInputs() {
if (!mShouldRequestExpirationDate || mExpirationContainer.getVisibility() == View.VISIBLE) {
return;
}
mExpirationContainer.setVisibility(View.VISIBLE);
mCardUnmaskInput.setEms(3);
mMonthInput.addTextChangedListener(this);
mYearInput.addTextChangedListener(this);
}
示例9: updateState
protected void updateState() {
Log.d(LOGTAG, "updateState");
Log.d(LOGTAG, "mEnabled="+mEnabled+", mHaveSurface="+mHaveSurface);
boolean willStart = mEnabled && mHaveSurface && mView.getVisibility() == View.VISIBLE;
if (willStart != mIsStarted) {
if(willStart) doStart();
else doStop();
} else {
Log.d(LOGTAG, "keeping State unchanged");
}
Log.d(LOGTAG, "updateState end");
}
示例10: navigateTo
private void navigateTo(int frame) {
boolean isSampling = findViewById(R.id.frameSampler).getVisibility() == View.VISIBLE;
if (frame == R.id.frameLibrary) {
libraryActivate();
} else {
findViewById(R.id.frameLibrary).setVisibility(View.INVISIBLE);
((TextView) findViewById(R.id.libraryText)).setTextColor(Color.parseColor("#FFFFFF"));
((ImageView) findViewById(R.id.libraryNavbarBtn)).setImageResource(R.drawable.ic_library_music);
}
if (frame == R.id.frameSampler) {
samplerActivate();
} else {
findViewById(R.id.frameSampler).setVisibility(View.INVISIBLE);
((TextView) findViewById(R.id.samplerText)).setTextColor(Color.parseColor("#FFFFFF"));
((ImageView) findViewById(R.id.samplerNavbarBtn)).setImageResource(R.drawable.ic_whatshot);
if (isSampling)
dispatch(SAMPLER_STOP);
}
if (frame == R.id.frameLoved) {
lovedActivate();
} else {
findViewById(R.id.frameLoved).setVisibility(View.INVISIBLE);
((TextView) findViewById(R.id.lovedText)).setTextColor(Color.parseColor("#FFFFFF"));
((ImageView) findViewById(R.id.lovedNavbarBtn)).setImageResource(R.drawable.ic_loved);
}
if (frame == R.id.frameSharing) {
sharingActivate();
} else {
findViewById(R.id.frameSharing).setVisibility(View.INVISIBLE);
((TextView) findViewById(R.id.sharingText)).setTextColor(Color.parseColor("#FFFFFF"));
((ImageView) findViewById(R.id.sharingNavbarBtn)).setImageResource(R.drawable.ic_sharing);
}
}
示例11: onLayout
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
ViewTreeObserver observer = getViewTreeObserver();
if (getVisibility() == View.VISIBLE && changed && observer != null && observer.isAlive()) {
observer.addOnPreDrawListener(mPredrawListener);
}
}
示例12: startAlphaAnimation
public static void startAlphaAnimation(View v, long duration, int visibility) {
AlphaAnimation alphaAnimation = (visibility == View.VISIBLE)
? new AlphaAnimation(0f, 1f)
: new AlphaAnimation(1f, 0f);
alphaAnimation.setDuration(duration);
alphaAnimation.setFillAfter(true);
v.startAnimation(alphaAnimation);
}
示例13: onNestedScroll
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child,
View target, int dxConsumed, int dyConsumed, int dxUnconsumed,
int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
child.hide();
RxBus.getInstance().post(AppConstant.MENU_SHOW_HIDE,false);
} else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
RxBus.getInstance().post(AppConstant.MENU_SHOW_HIDE,true);
child.show();
}
}
示例14: expandHabitCalendarViewOnClick
@OnClick(R.id.expand_habit_calendar_view)
void expandHabitCalendarViewOnClick() {
TransitionManager.beginDelayedTransition(habitCalendarContent);
TransitionManager.beginDelayedTransition(fragHabitRootLinearLayout);
TransitionManager.beginDelayedTransition(habitCalendarCard);
if(habitCalendarContent.getVisibility() == View.VISIBLE) {
habitCalendarContent.setVisibility(View.GONE);
} else {
habitCalendarContent.setVisibility(View.VISIBLE);
}
}
示例15: setVisibility
public void setVisibility(int visibility, int delay) {
super.setVisibility(visibility);
if (visibility == View.VISIBLE) {
startLoading(delay);
} else {
stopLoading();
}
}