List of usage examples for android.view View getPaddingTop
public int getPaddingTop()
From source file:com.commonsware.cwac.crossport.design.widget.BaseTransientBottomBar.java
/** * Constructor for the transient bottom bar. * * @param parent The parent for this transient bottom bar. * @param content The content view for this transient bottom bar. * @param contentViewCallback The content view callback for this transient bottom bar. *///from w w w .j ava2 s.co m protected BaseTransientBottomBar(@NonNull ViewGroup parent, @NonNull View content, @NonNull ContentViewCallback contentViewCallback) { if (parent == null) { throw new IllegalArgumentException("Transient bottom bar must have non-null parent"); } if (content == null) { throw new IllegalArgumentException("Transient bottom bar must have non-null content"); } if (contentViewCallback == null) { throw new IllegalArgumentException("Transient bottom bar must have non-null callback"); } mTargetParent = parent; mContentViewCallback = contentViewCallback; mContext = parent.getContext(); // ThemeUtils.checkAppCompatTheme(mContext); LayoutInflater inflater = LayoutInflater.from(mContext); // Note that for backwards compatibility reasons we inflate a layout that is defined // in the extending Snackbar class. This is to prevent breakage of apps that have custom // coordinator layout behaviors that depend on that layout. mView = (SnackbarBaseLayout) inflater.inflate(R.layout.design_layout_snackbar, mTargetParent, false); mView.addView(content); ViewCompat.setAccessibilityLiveRegion(mView, ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE); ViewCompat.setImportantForAccessibility(mView, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); // Make sure that we fit system windows and have a listener to apply any insets ViewCompat.setFitsSystemWindows(mView, true); ViewCompat.setOnApplyWindowInsetsListener(mView, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { // Copy over the bottom inset as padding so that we're displayed // above the navigation bar v.setPadding(v.getPaddingLeft(), v.getPaddingTop(), v.getPaddingRight(), insets.getSystemWindowInsetBottom()); return insets; } }); mAccessibilityManager = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); }
From source file:net.yaly.ViewPagerDoubleIndicator.java
private void updateTabStyles() { for (int i = 0; i < mTabCount; i++) { View v = mTabsContainer.getChildAt(i); v.setBackgroundResource(mTabBackgroundResId); v.setPadding(mTabPadding, v.getPaddingTop(), mTabPadding, v.getPaddingBottom()); TextView tab_title = (TextView) v.findViewById(R.id.vpdi_tab_title); if (tab_title != null) { tab_title.setTextColor(mTabTextColor); tab_title.setTypeface(mTabTextTypeface, mTabTextTypefaceStyle); tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (isTabTextAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab_title.setAllCaps(true); } else { tab_title.setText(tab_title.getText().toString() .toUpperCase(getResources().getConfiguration().locale)); }//from w w w.j a v a2 s .co m } } } }
From source file:com.mark.quick.ui.view.snackbar.BaseTransientBottomBar.java
/** * Constructor for the transient bottom bar. * * @param parent The parent for this transient bottom bar. * @param content The content view for this transient bottom bar. * @param contentViewCallback The content view callback for this transient bottom bar. *//*from w w w . java2s.co m*/ protected BaseTransientBottomBar(@NonNull ViewGroup parent, @NonNull View content, @NonNull ContentViewCallback contentViewCallback) { if (parent == null) { throw new IllegalArgumentException("Transient bottom bar must have non-null parent"); } if (content == null) { throw new IllegalArgumentException("Transient bottom bar must have non-null content"); } if (contentViewCallback == null) { throw new IllegalArgumentException("Transient bottom bar must have non-null callback"); } mTargetParent = parent; mContentViewCallback = contentViewCallback; mContext = parent.getContext(); ThemeUtils.checkAppCompatTheme(mContext); LayoutInflater inflater = LayoutInflater.from(mContext); // Note that for backwards compatibility reasons we inflate a layout that is defined // in the extending Snackbar class. This is to prevent breakage of apps that have custom // coordinator layout behaviors that depend on that layout. mView = (SnackbarBaseLayout) inflater.inflate(R.layout.mark_design_layout_snackbar, mTargetParent, false); mView.addView(content); ViewCompat.setAccessibilityLiveRegion(mView, ViewCompat.ACCESSIBILITY_LIVE_REGION_POLITE); ViewCompat.setImportantForAccessibility(mView, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); // Make sure that we fit system windows and have a listener to apply any insets ViewCompat.setFitsSystemWindows(mView, true); ViewCompat.setOnApplyWindowInsetsListener(mView, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { // Copy over the bottom inset as padding so that we're displayed // above the navigation bar v.setPadding(v.getPaddingLeft(), v.getPaddingTop(), v.getPaddingRight(), insets.getSystemWindowInsetBottom()); return insets; } }); mAccessibilityManager = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); }
From source file:com.qingsongchou.library.widget.tab.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < mTabCount; i++) { View v = mTabsContainer.getChildAt(i); v.setBackgroundResource(mTabBackgroundResId); v.setPadding(dipToPx(getContext(), 18), v.getPaddingTop(), dipToPx(getContext(), 4), v.getPaddingBottom());//from w w w . j a v a 2 s. c o m TextView tab_title = (TextView) v.findViewById(R.id.psts_tab_title); if (tab_title != null) { tab_title.setTextColor(mTabTextColor); tab_title.setTypeface(mTabTextTypeface, mTabTextTypefaceStyle); // tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabNormalTextSize); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (isTabTextAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab_title.setAllCaps(true); } else { tab_title.setText(tab_title.getText().toString() .toUpperCase(getResources().getConfiguration().locale)); } } } } }
From source file:com.github.takumalee.simplematerialtabpager.view.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); // v.setBackgroundResource(tabBackgroundColor != 0 ? tabBackgroundColor : tabBackgroundResId); v.setPadding(tabPadding, v.getPaddingTop(), tabPadding, v.getPaddingBottom()); if (v instanceof TextView) { TextView tabText = (TextView) v.findViewById(R.id.psts_tab_title); if (tabText != null) { tabText.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tabText.setAllCaps(true); } else { tabText.setText(tabText.getText().toString().toUpperCase(locale)); }// w w w .j a va 2s . c o m } } } } }
From source file:com.waz.zclient.pages.main.conversation.SingleImageFragment.java
private void loadClickedImageSizeAndPosition() { final View clickedImage = getControllerFactory().getSingleImageController().getImageContainer(); clickedImageHeight = clickedImage.getMeasuredHeight(); clickedImageWidth = clickedImage.getMeasuredWidth(); if (clickedImageHeight == 0 || clickedImageWidth == 0) { View parent = (View) clickedImage.getParent(); final int widthSpec = View.MeasureSpec.makeMeasureSpec( parent.getMeasuredWidth() - parent.getPaddingLeft() - parent.getPaddingRight(), View.MeasureSpec.EXACTLY); final int heightSpec = View.MeasureSpec.makeMeasureSpec( parent.getMeasuredHeight() - parent.getPaddingTop() - parent.getPaddingBottom(), View.MeasureSpec.EXACTLY); clickedImage.measure(widthSpec, heightSpec); clickedImageHeight = clickedImage.getMeasuredHeight(); clickedImageWidth = clickedImage.getMeasuredWidth(); }//from w ww.ja v a2 s .c o m clickedImageLocation = ViewUtils.getLocationOnScreen(clickedImage); int dx = 0; int dy = -ViewUtils.getStatusBarHeight(getActivity()); clickedImageLocation.offset(dx, dy); }
From source file:com.murrayc.galaxyzoo.app.QuestionFragment.java
private static void insertButtonInRow(final Context context, final TableRow row, final View button) { final TableRow.LayoutParams params = new TableRow.LayoutParams(0, TableRow.LayoutParams.MATCH_PARENT, 1f /* weight */); //Use as little padding as possible at the left and right because the button //will usually get extra space from the TableLayout anyway, //but we want to avoid ugly line-breaks when the text is long (such as in translations). //Space around the inside of the buttons: //When we use smaller dp values, there seems to be no padding at the sides at all, //probably because the edges of the button are actually dependent on the standard background //image for buttons. //2 * standard_margin is nicer, but there is usually more, because the buttons expand //and a too-small margin is better than splitting a word across lines. final int padding = UiUtils.getPxForDpResource(context, R.dimen.small_margin); button.setPadding(padding, button.getPaddingTop(), padding, padding); if (row.getChildCount() > 0) { //Space between the buttons: final int margin = UiUtils.getPxForDpResource(context, R.dimen.tiny_gap); params.setMargins(margin, 0, 0, 0); // When using the standard background drawable (not our custom background color // which replaces it) This reduces the space caused by the standard background drawable, // but negative margins are unmaintainable voodoo: // params.setMargins(-4, 0, -4, 0); }/* www . j a v a 2 s .co m*/ row.addView(button, params); }
From source file:com.yan.stamped.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final View.OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null; TextView tabTitleView = null;/*from www. j av a 2 s. c o m*/ if (mTabViewLayoutId != 0) { // If there is a custom tab view layout id set, try and inflate it tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false); tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId); } if (tabView == null) { tabView = createDefaultTabView(getContext()); } if (tabTitleView == null && TextView.class.isInstance(tabView)) { tabTitleView = (TextView) tabView; } tabTitleView.setText(adapter.getPageTitle(i)); tabTitleView.setTextColor(Color.WHITE); tabView.setOnClickListener(tabClickListener); tabView.setPadding(tabView.getPaddingLeft() + 27, tabView.getPaddingTop(), tabView.getPaddingRight() + 27, tabView.getPaddingBottom()); mTabStrip.addView(tabView); } }
From source file:yjbo.yy.ynewsrecycle.mainutil.PSFirst.java
private void updateTabStyles() { for (int i = 0; i < mTabCount; i++) { View v = mTabsContainer.getChildAt(i); // v.setBackgroundResource(mTabBackgroundResId); if (i == mTabCount - 1) {//?? float dimension = mcontext.getResources().getDimension(R.dimen.text_50); v.setPadding(mTabPadding, v.getPaddingTop(), (int) dimension, v.getPaddingBottom()); } else {/* ww w .j av a 2 s . c o m*/ v.setPadding(mTabPadding, v.getPaddingTop(), mTabPadding, v.getPaddingBottom()); } TextView tab_title = (TextView) v.findViewById(R.id.psts_tab_title); if (tab_title != null) { tab_title.setTypeface(mTabTextTypeface, mTabTextTypefaceStyle); tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (isTabTextAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab_title.setAllCaps(true); } else { tab_title.setText(tab_title.getText().toString() .toUpperCase(getResources().getConfiguration().locale)); } } if (tab_title.isSelected()) { // LogUtils.i("------" + i); // tab_title.setTextColor(Color.parseColor("#ffffff")); tab_title.setTextColor(Color.parseColor("#29b4ed")); this.setIndicatorHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0, getResources().getDisplayMetrics())); // tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX,mcontext.getResources().getDimension(R.dimen.honor_card_awesome_item_head_size)); // tab_title.setTextSize(16); // TextPaint tp = tab_title.getPaint(); // tp.setFakeBoldText(true); tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize); } else { // LogUtils.i("------" + i); this.setIndicatorHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0, getResources().getDisplayMetrics())); // tab_title.setTextColor(getResources().getColor(R.color.tab_default_text)); tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize); tab_title.setTextColor(Color.parseColor("#666666")); // TextPaint tp = tab_title.getPaint(); // tp.setFakeBoldText(false); } } } }
From source file:com.eccyan.widget.SpinningTabStrip.java
private void updateTabStyles() { for (int i = 0; i < realTabCount; i++) { View v = tabsContainer.getChildAt(i); if (!(pager.getAdapter() instanceof CustomTabProvider)) { v.setBackgroundResource(tabBackgroundResId); }/*www . j ava 2 s . com*/ v.setPadding(tabPadding, v.getPaddingTop(), tabPadding, v.getPaddingBottom()); TextView tabTitle = (TextView) v.findViewById(R.id.tab_title); if (tabTitle != null) { tabTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tabTitle.setTypeface(tabTypeface, pager.getCurrentItem() == i ? tabTypefaceSelectedStyle : tabTypefaceStyle); if (tabTextColor != null) { tabTitle.setTextColor(tabTextColor); } // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tabTitle.setAllCaps(true); } else { tabTitle.setText(tabTitle.getText().toString().toUpperCase(locale)); } } } } }