本文整理汇总了Java中android.support.v4.view.ViewCompat.setPaddingRelative方法的典型用法代码示例。如果您正苦于以下问题:Java ViewCompat.setPaddingRelative方法的具体用法?Java ViewCompat.setPaddingRelative怎么用?Java ViewCompat.setPaddingRelative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.view.ViewCompat
的用法示例。
在下文中一共展示了ViewCompat.setPaddingRelative方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyModeAndGravity
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void applyModeAndGravity() {
int paddingStart = 0;
if (mMode == MODE_SCROLLABLE) {
// If we're scrollable, or fixed at start, inset using padding
paddingStart = Math.max(0, mContentInsetStart - mTabPaddingStart);
}
ViewCompat.setPaddingRelative(mTabStrip, paddingStart, 0, 0, 0);
switch (mMode) {
case MODE_FIXED:
mTabStrip.setGravity(Gravity.CENTER_HORIZONTAL);
break;
case MODE_SCROLLABLE:
mTabStrip.setGravity(GravityCompat.START);
break;
}
updateTabViewsLayoutParams();
}
示例2: VersionViewHolder
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
VersionViewHolder(View view) {
super(view);
version = (TextView) view.findViewById(R.id.version);
status = (TextView) view.findViewById(R.id.status);
repository = (TextView) view.findViewById(R.id.repository);
size = (TextView) view.findViewById(R.id.size);
api = (TextView) view.findViewById(R.id.api);
incompatibleReasons = (TextView) view.findViewById(R.id.incompatible_reasons);
buildtype = (TextView) view.findViewById(R.id.buildtype);
added = (TextView) view.findViewById(R.id.added);
nativecode = (TextView) view.findViewById(R.id.nativecode);
int margin = context.getResources().getDimensionPixelSize(R.dimen.layout_horizontal_margin);
int padding = context.getResources().getDimensionPixelSize(R.dimen.details_activity_padding);
ViewCompat.setPaddingRelative(view, margin + padding + ViewCompat.getPaddingStart(view), view.getPaddingTop(), ViewCompat.getPaddingEnd(view), view.getPaddingBottom());
}
示例3: applyModeAndGravity
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void applyModeAndGravity() {
int paddingStart = 0;
if (mMode == MODE_SCROLLABLE) {
// If we're scrollable, or fixed at start, inset using padding
paddingStart = Math.max(0, mContentInsetStart - mTabPaddingStart);
}
ViewCompat.setPaddingRelative(mTabStrip, paddingStart, 0, 0, 0);
switch (mMode) {
case MODE_FIXED:
mTabStrip.setGravity(Gravity.CENTER_HORIZONTAL);
break;
case MODE_SCROLLABLE:
mTabStrip.setGravity(GravityCompat.START);
break;
}
updateTabViews(true);
}
示例4: TabView
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public TabView(Context context) {
super(context);
if (mTabBackgroundResId != 0) {
/*
ViewCompat.setBackground(
this, AppCompatResources.getDrawable(context, mTabBackgroundResId));
*/
ViewCompat.setBackground(
this, context.getDrawable(mTabBackgroundResId));
}
ViewCompat.setPaddingRelative(this, mTabPaddingStart, mTabPaddingTop,
mTabPaddingEnd, mTabPaddingBottom);
setGravity(Gravity.CENTER);
setOrientation(VERTICAL);
setClickable(true);
ViewCompat.setPointerIcon(this,
PointerIconCompat.getSystemIcon(getContext(), PointerIconCompat.TYPE_HAND));
}
示例5: initView
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void initView() {
if (this.tabStrip.getChildCount() > 0) {
View firstTab = this.tabStrip.getChildAt(0);
View lastTab = this.tabStrip.getChildAt(getChildCount() - 1);
int startWidth = BooheeTabUtils.getMeasuredWidth(firstTab);
if (startWidth == 0) {
startWidth = BooheeTabUtils.getWidth(firstTab);
}
int endWidth = BooheeTabUtils.getMeasuredWidth(lastTab);
if (endWidth == 0) {
endWidth = BooheeTabUtils.getWidth(lastTab);
}
int start = ((this.width - startWidth) / 2) - BooheeTabUtils.getMarginStart(firstTab);
int end = ((this.width - endWidth) / 2) - BooheeTabUtils.getMarginEnd(lastTab);
this.tabStrip.setMinimumWidth(this.tabStrip.getMeasuredWidth());
Helper.showLog(TAG, "width : " + this.width + " start " + start + " end : " + end);
ViewCompat.setPaddingRelative(this, start, getPaddingTop(), end, getPaddingBottom());
setClipToPadding(false);
}
setCenterChild();
}
示例6: applyModeAndGravity
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void applyModeAndGravity() {
int paddingStart = 0;
if (this.mMode == 0) {
paddingStart = Math.max(0, this.mContentInsetStart - this.mTabPaddingStart);
}
ViewCompat.setPaddingRelative(this.mTabStrip, paddingStart, 0, 0, 0);
switch (this.mMode) {
case 0:
this.mTabStrip.setGravity(GravityCompat.START);
break;
case 1:
this.mTabStrip.setGravity(1);
break;
}
updateTabViews(true);
}
示例7: TabView
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public TabView(Context context, Tab tab) {
super(context);
mTab = tab;
if (mTabBackgroundResId != 0) {
//setBackgroundDrawable(TintManager.getDrawable(context, mTabBackgroundResId));
}
ViewCompat.setPaddingRelative(this, mTabPaddingStart, mTabPaddingTop,
mTabPaddingEnd, mTabPaddingBottom);
setGravity(Gravity.CENTER);
update();
}
示例8: onSizeChanged
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if (tabStrip.isIndicatorAlwaysInCenter() && tabStrip.getChildCount() > 0) {
View firstTab = tabStrip.getChildAt(0);
View lastTab = tabStrip.getChildAt(tabStrip.getChildCount() - 1);
int start = (w - Utils.getMeasuredWidth(firstTab)) / 2 - Utils.getMarginStart(firstTab);
int end = (w - Utils.getMeasuredWidth(lastTab)) / 2 - Utils.getMarginEnd(lastTab);
tabStrip.setMinimumWidth(tabStrip.getMeasuredWidth());
ViewCompat.setPaddingRelative(this, start, getPaddingTop(), end, getPaddingBottom());
setClipToPadding(false);
}
}
示例9: TabView
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public TabView(Context context, int background, int[] margins,
int[] paddings, int tabMinWidth, int tabMaxWidth,
int tabTextSize, int tabTextAppearance, ColorStateList tabTextColors) {
super(context);
if (background != 0) {
setBackgroundDrawable(getDrawable(context, background));
}
ViewCompat.setPaddingRelative(this, paddings[0], paddings[1], paddings[2], paddings[3]);
mTabMinWidth = tabMinWidth;
mTabMaxWidth = tabMaxWidth;
mTabTextSize = tabTextSize;
mTabTextAppearance = tabTextAppearance;
mTabTextColors = tabTextColors;
MarginLayoutParams marginLayoutParams = new MarginLayoutParams(MarginLayoutParams.WRAP_CONTENT, MarginLayoutParams.WRAP_CONTENT);
marginLayoutParams.leftMargin = margins[0];
marginLayoutParams.topMargin = margins[1];
marginLayoutParams.rightMargin = margins[2];
marginLayoutParams.bottomMargin = margins[3];
setLayoutParams(marginLayoutParams);
setGravity(Gravity.CENTER);
}
示例10: setHelperTextEnabled
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void setHelperTextEnabled(boolean _enabled) {
if (mHelperTextEnabled == _enabled) return;
if (_enabled && mErrorEnabled) {
setErrorEnabled(false);
}
if (this.mHelperTextEnabled != _enabled) {
if (_enabled) {
this.mHelperView = new TextView(this.getContext());
this.mHelperView.setTextAppearance(this.getContext(), this.mHelperTextAppearance);
if (mHelperTextColor != null){
this.mHelperView.setTextColor(mHelperTextColor);
}
this.mHelperView.setVisibility(INVISIBLE);
this.addView(this.mHelperView);
if (this.mHelperView != null) {
ViewCompat.setPaddingRelative(
this.mHelperView,
ViewCompat.getPaddingStart(getEditText()),
0, ViewCompat.getPaddingEnd(getEditText()),
getEditText().getPaddingBottom());
}
} else {
this.removeView(this.mHelperView);
this.mHelperView = null;
}
this.mHelperTextEnabled = _enabled;
}
}
示例11: TabView
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public TabView(Context context) {
super(context);
if (TabLayout.this.mTabBackgroundResId != 0) {
setBackgroundDrawable(AppCompatDrawableManager.get().getDrawable(context, TabLayout.this.mTabBackgroundResId));
}
ViewCompat.setPaddingRelative(this, TabLayout.this.mTabPaddingStart, TabLayout.this.mTabPaddingTop, TabLayout.this.mTabPaddingEnd, TabLayout.this.mTabPaddingBottom);
setGravity(17);
setOrientation(1);
setClickable(true);
}
示例12: updateTopBottomPadding
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private static void updateTopBottomPadding(View view, int topPadding, int bottomPadding) {
if (ViewCompat.isPaddingRelative(view)) {
ViewCompat.setPaddingRelative(view, ViewCompat.getPaddingStart(view), topPadding, ViewCompat.getPaddingEnd(view), bottomPadding);
} else {
view.setPadding(view.getPaddingLeft(), topPadding, view.getPaddingRight(), bottomPadding);
}
}
示例13: onCreateViewHolder
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public DefaultAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
TabTextView tabTextView = new TabTextView(parent.getContext());
if (mTabSelectedTextColorSet) {
tabTextView.setTextColor(tabTextView.createColorStateList(
tabTextView.getCurrentTextColor(), mTabSelectedTextColor));
}
ViewCompat.setPaddingRelative(tabTextView, mTabPaddingStart, mTabPaddingTop,
mTabPaddingEnd, mTabPaddingBottom);
tabTextView.setTextAppearance(parent.getContext(), mTabTextAppearance);
tabTextView.setGravity(Gravity.CENTER);
tabTextView.setMaxLines(MAX_TAB_TEXT_LINES);
tabTextView.setEllipsize(TextUtils.TruncateAt.END);
if (mTabOnScreenLimit > 0) {
int width = parent.getMeasuredWidth() / mTabOnScreenLimit;
tabTextView.setMaxWidth(width);
tabTextView.setMinWidth(width);
} else {
if (mTabMaxWidth > 0) {
tabTextView.setMaxWidth(mTabMaxWidth);
}
tabTextView.setMinWidth(mTabMinWidth);
}
tabTextView.setTextAppearance(tabTextView.getContext(), mTabTextAppearance);
if (mTabSelectedTextColorSet) {
tabTextView.setTextColor(tabTextView.createColorStateList(
tabTextView.getCurrentTextColor(), mTabSelectedTextColor));
}
if (mTabBackgroundResId != 0) {
tabTextView.setBackgroundDrawable(
AppCompatResources.getDrawable(tabTextView.getContext(), mTabBackgroundResId));
}
tabTextView.setLayoutParams(createLayoutParamsForTabs());
return new ViewHolder(tabTextView);
}
示例14: adjustIndicatorPadding
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void adjustIndicatorPadding() {
// Add padding to the error and character counter so that they match the EditText
ViewCompat.setPaddingRelative(mIndicatorArea, ViewCompat.getPaddingStart(mEditText),
0, ViewCompat.getPaddingEnd(mEditText), mEditText.getPaddingBottom());
}
示例15: adjustIndicatorPadding
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void adjustIndicatorPadding() {
ViewCompat.setPaddingRelative(this.mIndicatorArea, ViewCompat.getPaddingStart(this.mEditText), 0, ViewCompat.getPaddingEnd(this.mEditText), this.mEditText.getPaddingBottom());
}