View getPaddingTop - 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 getPaddingTop method.

This code example shows how to use the following methods:getPaddingBottom, getPaddingTop, setPadding
    public View onCreateView(LayoutInflater inflater,
            ViewGroup container, Bundle savedInstanceState) {
        final View view = super.onCreateView(inflater, container, savedInstanceState);
        final ListView list = (ListView) view.findViewById(android.R.id.list);
        // our container already takes care of the padding 
        int paddingTop = list.getPaddingTop();
        int paddingBottom = list.getPaddingBottom();
        list.setPadding(0, paddingTop, 0, paddingBottom);
        return view;
    } 
 
    @Override 
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        if (preference == mPrivacyGuardDefault) {
            boolean value = (Boolean) newValue;
            Settings.Secure.putInt(getContentResolver(),
                    Settings.Secure.PRIVACY_GUARD_DEFAULT, value ? 1 : 0);
            return true; 
        } 
        return false; 
8
CodeRank
This code example shows how to use the following methods:getBackground, getHeight, getPaddingBottom, getPaddingTop, getTop
This code example shows how to use the following methods:getLayoutParams, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop
7
CodeRank
This code example shows how to use the following methods:getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, measure
        int frameHeight = getHeight();
 
        FrameLayout f = mFrame;
 
        int horizontalPadding = Math.max(
                f.getPaddingLeft() + f.getPaddingRight(),
                (int) (MIN_HORIZONTAL_MARGIN * mMetrics.density));
        int verticalPadding = f.getPaddingBottom() + f.getPaddingTop();
 
        // Ignore the vertical paddings, so that we won't draw the frame on the 
        // top and bottom sides 
        int previewHeight = frameHeight;
        int previewWidth = frameWidth - horizontalPadding;
 
        // resize frame and preview for aspect ratio 
        if(mAspectRatio >= 0.0){
	        if (previewWidth > previewHeight * mAspectRatio) {
	            previewWidth = (int) (previewHeight * mAspectRatio + .5);
	        } else { 
	            previewHeight = (int) (previewWidth / mAspectRatio + .5);

7
CodeRank
This code example shows how to use the following methods:getPaddingBottom, getPaddingTop, setPadding
This code example shows how to use the following methods:getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, measure
        int frameWidth = getWidth();
        int frameHeight = getHeight();
 
        FrameLayout f = mFrame;
 
        int horizontalPadding = Math.max(f.getPaddingLeft() + f.getPaddingRight(),(int) (MIN_HORIZONTAL_MARGIN * mMetrics.density));
        int verticalPadding = f.getPaddingBottom() + f.getPaddingTop();
 
        // Ignore the vertical paddings, so that we won't draw the frame on the 
        // top and bottom sides 
        int previewHeight = frameHeight;
        int previewWidth = frameWidth - horizontalPadding;
 
        // resize frame and preview for aspect ratio 
        if (previewWidth > previewHeight * mAspectRatio) {
            previewWidth = (int) (previewHeight * mAspectRatio + .5);
        } else { 
            previewHeight = (int) (previewWidth / mAspectRatio + .5);
        } 
        frameWidth = previewWidth + horizontalPadding;

7
CodeRank
This code example shows how to use the following methods:getBackground, getHeight, getPaddingBottom, getPaddingTop, getTop
7
CodeRank
This code example shows how to use the following methods:getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop
This code example shows how to use the following methods:getPaddingBottom, getPaddingLeft, getPaddingTop, setPadding, setVisibility
		// prepare widget frame 
		LinearLayout widgetFrameView = ((LinearLayout)view.findViewById(android.R.id.widget_frame));
		if (widgetFrameView == null) return;
 
		// remove already created widgets 
		int count = widgetFrameView.getChildCount();
		if (count > 0) {
			widgetFrameView.removeViews(0, count);
		} 
 
		// add our view only if the preference is active 
		if (isEnabled()) {
			widgetFrameView.setVisibility(View.VISIBLE);
			final boolean preApi14 = android.os.Build.VERSION.SDK_INT < 14;
			final int rightPadding = (int) (getContext().getResources().getDisplayMetrics().density * (preApi14 ? 10 : 7));
			widgetFrameView.setPadding(
					widgetFrameView.getPaddingLeft(),
					widgetFrameView.getPaddingTop(),
					rightPadding,
					widgetFrameView.getPaddingBottom()

6
CodeRank
This code example shows how to use the following methods:getPaddingBottom, getPaddingTop, setPadding
            ViewGroup container, Bundle savedInstanceState) {
        final View view = super.onCreateView(inflater, container, savedInstanceState);
        final ListView list = (ListView) view.findViewById(android.R.id.list);
        // our container already takes care of the padding 
        if (list != null) {
            int paddingTop = list.getPaddingTop();
            int paddingBottom = list.getPaddingBottom();
            list.setPadding(0, paddingTop, 0, paddingBottom);
        } 
        return view;
    } 
 
    @Override 
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        return false; 
    } 
} 
6
CodeRank

Related View getPaddingTop Questions & Answers:

getPaddingTop Method Overview
Returns the top padding of this view.
See Code Examples for other Android View Methods: