本文整理汇总了Java中android.view.View.getPaddingStart方法的典型用法代码示例。如果您正苦于以下问题:Java View.getPaddingStart方法的具体用法?Java View.getPaddingStart怎么用?Java View.getPaddingStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.getPaddingStart方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: getPaddingStart
import android.view.View; //导入方法依赖的package包/类
/**
* @see android.view.View#getPaddingStart()
*/
public static int getPaddingStart(View view) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return view.getPaddingStart();
} else {
// Before JB MR1, all layouts are left-to-right, so start == left.
return view.getPaddingLeft();
}
}
示例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);
}
}
示例4: getPaddingStart
import android.view.View; //导入方法依赖的package包/类
public static int getPaddingStart(View view) {
return view.getPaddingStart();
}