List of usage examples for android.view View setPadding
public void setPadding(int left, int top, int right, int bottom)
From source file:com.juma.view.PagerSlidingTabStrip.java
private void addTab(final int position, View tab) { tab.setFocusable(true);//from w w w . j a v a 2s . co m tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (position != lastPosition) { TextView t; t = (TextView) tabsContainer.getChildAt(lastPosition); t.setTextColor(tabTextColor); t.setTextSize(12); t = (TextView) tabsContainer.getChildAt(position); t.setTextColor(getResources().getColor(R.color.item5)); t.setTextSize(17); lastPosition = position; invalidate(); } pager.setCurrentItem(position); } }); tab.setPadding(tabPadding, 0, tabPadding, 0); tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); }
From source file:com.miz.functions.MizLib.java
public static void addNavigationBarPadding(Context c, View v) { v.setPadding(0, 0, 0, getNavigationBarHeight(c)); }
From source file:com.yomii.view.PagerSlidingTab.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setLayoutParams(shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); if (tabCount == 1) v.setBackgroundResource(tabBackgroundResId); else if (i == 0) { v.setBackgroundResource(firstTabBackgroundResId); v.setSelected(true);/*from w ww .j a v a2 s . co m*/ } else if (i == tabCount - 1) v.setBackgroundResource(lastTabBackgroundResId); else v.setBackgroundResource(tabBackgroundResId); if (shouldExpand) { //v.setPadding(0, 0, 0, 0); tabsContainer.setPadding(tabPadding, 0, tabPadding, 0); } else { v.setPadding(tabPadding, 0, tabPadding, 0); } if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(i == 0 ? indicatorColor : 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) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:com.cplatform.xhxw.ui.ui.base.view.PagerSlidingTabStrip.java
private void addTab(final int position, View tab) { tab.setFocusable(true);/*from w ww. ja v a2 s . c om*/ tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pager.setCurrentItem(position); isTabItemClick = true; MobclickAgent.onEvent(getContext(), StatisticalKey.channel_onclick); String channelid = null; if (is_in_home && showList != null && position < tabCount && position < showList.size()) { channelid = showList.get(position).getChannelID(); UmsAgent.onEvent(getContext(), StatisticalKey.channel_onclick, new String[] { StatisticalKey.key_channelid }, new String[] { channelid }); } } }); tab.setPadding(tabPadding, 0, tabPadding, 0); tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); }
From source file:com.jasonchen.microlang.view.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}./* w w w.j a va 2s .com*/ */ protected View createDefaultTabView(Context context) { View v; if (mIconAdapter == null) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setAllCaps(true); textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)); v = textView; } else { ImageView imgView = new TintImageView(context); imgView.setScaleType(ImageView.ScaleType.FIT_XY); imgView.setLayoutParams(new LinearLayout.LayoutParams(mTabIconSize, mTabIconSize)); v = imgView; } TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); v.setBackgroundResource(outValue.resourceId); int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); v.setPadding(padding, padding, padding, padding); return v; }
From source file:com.yktx.check.widget.PagerSlidingTabStrip.java
private void addTab(final int position, View tab) { tab.setFocusable(true);/* w w w. j a v a2s . c om*/ tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pager.setCurrentItem(position); if (position == 4 && isAlertVisibility) { // isAlertVisibility = false; // image2.setVisibility(View.INVISIBLE); // // addBadgeView(0, false); // GroupMainFragmentActivity.mEditor.putBoolean("isred", false); // GroupMainFragmentActivity.mEditor.commit(); } } }); if (position == 3) { tab.setPadding(tabPadding, 0, 12, 0); } else { tab.setPadding(tabPadding, 0, tabPadding, 0); } tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); }
From source file:com.csdn.pagerslidingtabstrip.view.PagerSlidingTabStrip.java
private void addTab2(final int position, View tab) { tab.setFocusable(true);// w w w.j a v a2s . c o m tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // pager.setCurrentItem(position); int tmep = selectedPosition; selectedPosition = position; lastposition = selectedPosition; choose(tmep, selectedPosition); if (selectListener != null) { selectListener.select(position); } //updateTabStyles(); // invalidate(); // scrollToChild(currentPosition, 0); } }); tab.setPadding(tabPadding, 0, tabPadding, 0); tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); }
From source file:com.example.linkagescroll.widget.PagerSlidingTabStrip.java
private void addTab(final int position, View tab) { tab.setFocusable(true);/* ww w . j a v a 2 s .c om*/ if (tabClickable) { tab.setOnClickListener(new OnClickListener() { public static final int MIN_CLICK_DELAY_TIME = 1000; private long lastClickTime = 0; @Override public void onClick(View v) { pager.setCurrentItem(position); long currentTime = Calendar.getInstance().getTimeInMillis(); if (currentTime - lastClickTime > MIN_CLICK_DELAY_TIME) { lastClickTime = currentTime; } else { if (doubleClickListener != null) { doubleClickListener.onClick(position); } } } }); } tab.setPadding(tabPadding, 0, tabPadding, 0); tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); }
From source file:org.getlantern.firetweet.fragment.support.StatusFragment.java
@Override protected void fitSystemWindows(Rect insets) { super.fitSystemWindows(insets); final View view = getView(); if (view != null) { view.setPadding(insets.left, insets.top, insets.right, insets.bottom); }/*w w w . j av a 2 s .c o m*/ }
From source file:com.andrada.sitracker.ui.fragment.PublicationInfoFragment.java
private void showCustomPositionedCrouton(String message, boolean success) { if (getActivity() == null) { return;//from ww w. ja v a 2 s.co m } View view = getLayoutInflater(null).inflate(R.layout.crouton_custom_pos_textview, null); if (success) { view.findViewById(android.R.id.background).setBackgroundColor(Style.holoGreenLight); } else { view.findViewById(android.R.id.background).setBackgroundColor(Style.holoRedLight); } int topPadding = UIUtils.calculateActionBarSize(getActivity()); if (!mHasPhoto) { topPadding = (int) (newTop + mHeaderHeightPixels); } view.setPadding(view.getPaddingLeft(), topPadding, view.getPaddingRight(), view.getPaddingBottom()); TextView tv = (TextView) view.findViewById(android.R.id.text1); tv.setText(message); Crouton cr = Crouton.make(getActivity(), view); cr.setConfiguration(new Configuration.Builder().setDuration(Configuration.DURATION_LONG).build()); cr.show(); }