當前位置: 首頁>>代碼示例>>Java>>正文


Java View.setPaddingRelative方法代碼示例

本文整理匯總了Java中android.view.View.setPaddingRelative方法的典型用法代碼示例。如果您正苦於以下問題:Java View.setPaddingRelative方法的具體用法?Java View.setPaddingRelative怎麽用?Java View.setPaddingRelative使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.View的用法示例。


在下文中一共展示了View.setPaddingRelative方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: forceCustomPadding

import android.view.View; //導入方法依賴的package包/類
public static void forceCustomPadding(View view, boolean additive) {
    final Resources res = view.getResources();
    final int paddingSide = res.getDimensionPixelSize(R.dimen.settings_side_margin);

    final int paddingStart = paddingSide + (additive ? view.getPaddingStart() : 0);
    final int paddingEnd = paddingSide + (additive ? view.getPaddingEnd() : 0);
    final int paddingBottom = res.getDimensionPixelSize(
            R.dimen.preference_fragment_padding_bottom);

    view.setPaddingRelative(paddingStart, 0, paddingEnd, paddingBottom);
}
 
開發者ID:Trumeet,項目名稱:MiPushFramework,代碼行數:12,代碼來源:Utils.java

示例2: setPaddingRelative

import android.view.View; //導入方法依賴的package包/類
/**
 * @see android.view.View#setPaddingRelative(int, int, int, int)
 */
public static void setPaddingRelative(View view, int start, int top, int end, int bottom) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        view.setPaddingRelative(start, top, end, bottom);
    } else {
        // Before JB MR1, all layouts are left-to-right, so start == left, etc.
        view.setPadding(start, top, end, bottom);
    }
}
 
開發者ID:lizhangqu,項目名稱:chromium-net-for-android,代碼行數:12,代碼來源:ApiCompatibilityUtils.java

示例3: setPaddingVertical

import android.view.View; //導入方法依賴的package包/類
/**
 * Sets the top and bottom padding to the given View, keeping the horizontal padding values as the were.
 *
 * @param view    Which view to set the padding to, must not be {@code null}
 * @param padding The vertical padding value
 */
public static void setPaddingVertical(@NonNull final View view, @Px final int padding) {
    final int paddingStart = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ? view.getPaddingStart() : view.getPaddingLeft();
    final int paddingEnd = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ? view.getPaddingEnd() : view.getPaddingRight();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        view.setPaddingRelative(paddingStart, padding, paddingEnd, padding);
    } else {
        view.setPadding(paddingStart, padding, paddingEnd, padding);
    }
}
 
開發者ID:milosmns,項目名稱:silly-android,代碼行數:16,代碼來源:SillyAndroid.java

示例4: setPaddingHorizontal

import android.view.View; //導入方法依賴的package包/類
/**
 * Sets the left/start and right/end padding to the given View, keeping the vertical padding values as the were.
 *
 * @param view    Which view to set the padding to, must not be {@code null}
 * @param padding The horizontal padding value
 */
public static void setPaddingHorizontal(@NonNull final View view, @Px final int padding) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        view.setPaddingRelative(padding, view.getPaddingTop(), padding, view.getPaddingBottom());
    } else {
        view.setPadding(padding, view.getPaddingTop(), padding, view.getPaddingBottom());
    }
}
 
開發者ID:milosmns,項目名稱:silly-android,代碼行數:14,代碼來源:SillyAndroid.java

示例5: setPaddingRelative

import android.view.View; //導入方法依賴的package包/類
public static void setPaddingRelative(View view, int start, int top, int end, int bottom) {
    view.setPaddingRelative(start, top, end, bottom);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:4,代碼來源:ViewCompatJellybeanMr1.java

示例6: setPaddingStart

import android.view.View; //導入方法依賴的package包/類
public static void setPaddingStart(View view, int paddingStart) {
    view.setPaddingRelative(paddingStart,
            view.getPaddingTop(),
            view.getPaddingEnd(),
            view.getPaddingBottom());
}
 
開發者ID:haihaio,項目名稱:AmenEye,代碼行數:7,代碼來源:ViewUtil.java

示例7: setPaddingTop

import android.view.View; //導入方法依賴的package包/類
public static void setPaddingTop(View view, int paddingTop) {
    view.setPaddingRelative(view.getPaddingStart(),
            paddingTop,
            view.getPaddingEnd(),
            view.getPaddingBottom());
}
 
開發者ID:haihaio,項目名稱:AmenEye,代碼行數:7,代碼來源:ViewUtil.java

示例8: setPaddingEnd

import android.view.View; //導入方法依賴的package包/類
public static void setPaddingEnd(View view, int paddingEnd) {
    view.setPaddingRelative(view.getPaddingStart(),
            view.getPaddingTop(),
            paddingEnd,
            view.getPaddingBottom());
}
 
開發者ID:haihaio,項目名稱:AmenEye,代碼行數:7,代碼來源:ViewUtil.java

示例9: setPaddingBottom

import android.view.View; //導入方法依賴的package包/類
public static void setPaddingBottom(View view, int paddingBottom) {
    view.setPaddingRelative(view.getPaddingStart(),
            view.getPaddingTop(),
            view.getPaddingEnd(),
            paddingBottom);
}
 
開發者ID:haihaio,項目名稱:AmenEye,代碼行數:7,代碼來源:ViewUtil.java

示例10: setPadding

import android.view.View; //導入方法依賴的package包/類
/**
 * Sets the padding to the given View.
 *
 * @param view   Which view to set the padding to, must not be {@code null}
 * @param start  Start padding ('left' for old devices)
 * @param top    Top padding
 * @param end    End padding ('right' for old devices)
 * @param bottom Bottom padding
 */
public static void setPadding(@NonNull final View view, @Px final int start, @Px final int top, @Px final int end, @Px final int bottom) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        view.setPaddingRelative(start, top, end, bottom);
    } else {
        view.setPadding(start, top, end, bottom);
    }
}
 
開發者ID:milosmns,項目名稱:silly-android,代碼行數:17,代碼來源:SillyAndroid.java


注:本文中的android.view.View.setPaddingRelative方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。