View setVisibility - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for View setVisibility method.

This code example shows how to use the following methods:setBackgroundColor, setLayoutParams, setVisibility, addView, addContentView
This code example shows how to use the following methods:setVisibility, setOnZoomInClickListener, setOnZoomOutClickListener, setZoomSpeed
				return super.onSingleTapConfirmed(e);
			} 
		}); 
		gestureDetector.setIsLongpressEnabled(false);
 
		zoomControls = new ZoomControls(context);
		addView(zoomControls);
		zoomControls.setVisibility(View.GONE);
		zoomControls.setZoomSpeed(75);
		zoomControls.setOnZoomInClickListener(new OnClickListener()
		{ 
			public void onClick(View v)
			{ 
				handleScaleUp(); 
			} 
		}); 
		zoomControls.setOnZoomOutClickListener(new OnClickListener()
		{ 
			public void onClick(View v)
			{ 

9
CodeRank
This code example shows how to use the following methods:ofFloat, setAlpha, setVisibility
        if (securityMessageDisplay != null) {
            securityMessageDisplay.showBouncer(duration);
        } 
        if (ecaView != null) {
            if (duration > 0) {
                Animator anim = ObjectAnimator.ofFloat(ecaView, "alpha", 0f);
                anim.setDuration(duration);
                anim.addListener(new AnimatorListenerAdapter() {
                    private boolean mCanceled;
                    @Override 
                    public void onAnimationCancel(Animator animation) {
                        // Fail safe and show the emergency button in onAnimationEnd() 
                        mCanceled = true;
                        ecaView.setAlpha(1f);
                    } 
                    @Override 
                    public void onAnimationEnd(Animator animation) {
                        ecaView.setVisibility(mCanceled ? View.VISIBLE : View.INVISIBLE);
                    } 
                }); 

9
CodeRank
This code example shows how to use the following methods:getVisibility, setVisibility, setText
        mPreserveIconSpacing = mForceShowIcon = forceShow;
    } 
 
    public void setTitle(CharSequence title) {
        if (title != null) {
            mTitleView.setText(title);
 
            if (mTitleView.getVisibility() != VISIBLE) mTitleView.setVisibility(VISIBLE);
        } else { 
            if (mTitleView.getVisibility() != GONE) mTitleView.setVisibility(GONE);
        } 
    } 
 
    public MenuItemImpl getItemData() { 
        return mItemData;
    } 
 
    public void setCheckable(boolean checkable) {
 
        if (!checkable && mRadioButton == null && mCheckBox == null) {
8
CodeRank
This code example shows how to use the following methods:setId, setVisibility, setGravity, setPadding, setText
This code example shows how to use the following methods:getHeight, getLayoutParams, getVisibility, setVisibility
 
    public CollapseAnimation(View view, int duration) {
 
        setDuration(duration);
        mAnimatedView = view;
        mViewLayoutParams = (LinearLayout.LayoutParams) view.getLayoutParams();
 
        // decide to show or hide the view 
        mIsVisibleAfter = (view.getVisibility() == View.VISIBLE);
 
        mMarginStart = mViewLayoutParams.bottomMargin;
        mMarginEnd = (mMarginStart == 0 ? (0 - view.getHeight()) : 0);
 
        view.setVisibility(View.VISIBLE);
    } 
 
    @Override 
    protected void applyTransformation(float interpolatedTime, Transformation t) {
        super.applyTransformation(interpolatedTime, t);
 
8
CodeRank
This code example shows how to use the following methods:setTag, setVisibility, setText
    private HttpImageGetter show(final TextView view, final CharSequence html) {
        if (TextUtils.isEmpty(html))
            return hide(view);
 
        try { 
            view.setText(html);
        } 
        catch (Exception e) {
        } 
        view.setVisibility(VISIBLE);
        view.setTag(null);
        return this;
    } 
 
    private HttpImageGetter hide(final TextView view) {
        view.setText(null);
        view.setVisibility(GONE);
        view.setTag(null);
        return this;
    } 

8
CodeRank
This code example shows how to use the following methods:setVisibility, setEllipsize, setGravity, setSingleLine, setText
     * Returns the text view for the app name, creating it if necessary. 
     */ 
    public void setNameText(CharSequence text) {
        if (!TextUtils.isEmpty(text)) {
            if (mNameTextView == null) {
                mNameTextView = new TextView(mContext);
                mNameTextView.setSingleLine(true);
                mNameTextView.setEllipsize(TruncateAt.END);
                mNameTextView.setTextAppearance(mContext, android.R.style.TextAppearance_Large);
                mNameTextView.setGravity(Gravity.CENTER_VERTICAL);
                addView(mNameTextView);
            } 
            mNameTextView.setText(text);
            mNameTextView.setVisibility(View.VISIBLE);
        } else { 
            if (mNameTextView != null) {
                mNameTextView.setVisibility(View.GONE);
            } 
        } 
    } 
8
CodeRank
This code example shows how to use the following methods:getImportantForAccessibility, setImportantForAccessibility, setVisibility
    @SuppressLint("NewApi") 
    public void setEmptyView(View emptyView) {
        mEmptyView = emptyView;
        if (VERSION.SDK_INT >= 16
                && emptyView != null
                && emptyView.getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
            emptyView
                    .setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
        } 
        final T adapter = getAdapter();
        final boolean empty = adapter == null || adapter.isEmpty();
        updateEmptyStatus(empty);
    } 
 
    @Override 
    public void setFocusable(boolean focusable) {
        final T adapter = getAdapter();
        final boolean empty = adapter == null || adapter.getCount() == 0;
        mDesiredFocusableState = focusable;
        if (!focusable) {

8
CodeRank
This code example shows how to use the following methods:setVisibility, setText
        return text;
    } 
 
    private void setViewText(TextView v, CharSequence text) {
        // Set the text even if it's null, since we need to clear any previous text. 
        v.setText(text);
 
        if (TextUtils.isEmpty(text)) {
            v.setVisibility(View.GONE);
        } else { 
            v.setVisibility(View.VISIBLE);
        } 
    } 
 
    private Drawable getIcon1(Cursor cursor) {
        if (mIconName1Col == INVALID_INDEX) {
            return null; 
        } 
        String value = cursor.getString(mIconName1Col);
        Drawable drawable = getDrawableFromResourceValue(value);
8
CodeRank

Related View setVisibility Questions & Answers:

Other View setVisibility Examples

36:	        DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
37:	        view.startDrag(data, shadowBuilder, view, 0);
38:	        view.setVisibility(View.INVISIBLE);
39:	        return true;
40:	      } else {
-
68:	        LinearLayout container = (LinearLayout) v;
69:	        container.addView(view);
70:	        view.setVisibility(View.VISIBLE);
71:	        break;
72:	      case DragEvent.ACTION_DRAG_ENDED:

Read More

24:			// layout background transparent
25:			llStats.getBackground().setAlpha(150);
26:			llStats.setVisibility(View.VISIBLE);
27:	
28:			Intent i = getIntent();

Read More

60:	        }else{
61:	        	// hide the counter view
62:	        	txtCount.setVisibility(View.GONE);
63:	        }
64:

Read More

166:		private void updateUI(boolean isSignedIn) {
167:			if (isSignedIn) {
168:				btnSignIn.setVisibility(View.GONE);
169:				btnSignOut.setVisibility(View.VISIBLE);
170:				btnRevokeAccess.setVisibility(View.VISIBLE);
-
167:			if (isSignedIn) {
168:				btnSignIn.setVisibility(View.GONE);
169:				btnSignOut.setVisibility(View.VISIBLE);
170:				btnRevokeAccess.setVisibility(View.VISIBLE);
171:				llProfileLayout.setVisibility(View.VISIBLE);
-
168:				btnSignIn.setVisibility(View.GONE);
169:				btnSignOut.setVisibility(View.VISIBLE);
170:				btnRevokeAccess.setVisibility(View.VISIBLE);
171:				llProfileLayout.setVisibility(View.VISIBLE);
172:			} else {
-
169:				btnSignOut.setVisibility(View.VISIBLE);
170:				btnRevokeAccess.setVisibility(View.VISIBLE);
171:				llProfileLayout.setVisibility(View.VISIBLE);
172:			} else {
173:				btnSignIn.setVisibility(View.VISIBLE);
-
171:				llProfileLayout.setVisibility(View.VISIBLE);
172:			} else {
173:				btnSignIn.setVisibility(View.VISIBLE);
174:				btnSignOut.setVisibility(View.GONE);
175:				btnRevokeAccess.setVisibility(View.GONE);
-
172:			} else {
173:				btnSignIn.setVisibility(View.VISIBLE);
174:				btnSignOut.setVisibility(View.GONE);
175:				btnRevokeAccess.setVisibility(View.GONE);
176:				llProfileLayout.setVisibility(View.GONE);
-
173:				btnSignIn.setVisibility(View.VISIBLE);
174:				btnSignOut.setVisibility(View.GONE);
175:				btnRevokeAccess.setVisibility(View.GONE);
176:				llProfileLayout.setVisibility(View.GONE);
177:			}
-
174:				btnSignOut.setVisibility(View.GONE);
175:				btnRevokeAccess.setVisibility(View.GONE);
176:				llProfileLayout.setVisibility(View.GONE);
177:			}
178:		}

Read More

setVisibility Method Overview
Set the enabled state of this view.
See Code Examples for other Android View Methods: