当前位置: 首页>>代码示例>>Java>>正文


Java ViewCompat.setPaddingRelative方法代码示例

本文整理汇总了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();
 }
 
开发者ID:TIIEHenry,项目名称:TIIEHenry-Android-SDK,代码行数:20,代码来源:TabLayout.java

示例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());
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:17,代码来源:AppDetailsRecyclerViewAdapter.java

示例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);
}
 
开发者ID:commonsguy,项目名称:cwac-crossport,代码行数:20,代码来源:TabLayoutLite.java

示例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));
    }
 
开发者ID:commonsguy,项目名称:cwac-crossport,代码行数:19,代码来源:TabLayoutLite.java

示例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();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:22,代码来源:BooheeTabLayout.java

示例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);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:TabLayout.java

示例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();
}
 
开发者ID:TIIEHenry,项目名称:TIIEHenry-Android-SDK,代码行数:12,代码来源:TabLayout.java

示例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);
  }
}
 
开发者ID:devzwy,项目名称:KUtils,代码行数:14,代码来源:SmartTabLayout.java

示例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);
}
 
开发者ID:sanyuzhang,项目名称:CircularViewPager,代码行数:28,代码来源:CircularTabLayoutAdapter.java

示例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;
	}
}
 
开发者ID:TrustWallet,项目名称:trust-wallet-android,代码行数:30,代码来源:HelperTextInputLayout.java

示例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);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:TabLayout.java

示例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);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:8,代码来源:Snackbar.java

示例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);
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:42,代码来源:RecyclerTabLayout.java

示例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());
}
 
开发者ID:commonsguy,项目名称:cwac-crossport,代码行数:6,代码来源:TextInputLayout.java

示例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());
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:TextInputLayout.java


注:本文中的android.support.v4.view.ViewCompat.setPaddingRelative方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。