List of usage examples for android.view View setPadding
public void setPadding(int left, int top, int right, int bottom)
From source file:com.haomee.view.PagerSlidingTabStrip.java
private void addTab(final int position, View tab) { tab.setFocusable(true);//from w w w .java 2 s. com tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pager.setCurrentItem(position); } }); tab.setPadding(tabPadding, 0, tabPadding, 8); tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); }
From source file:com.cc.digital.mylayout.PagerSlidingTabStrip.java
private void addTab(final int position, View tab) { tab.setFocusable(true);/*from w ww . j a v a2 s . c om*/ tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Log.e("position:", "" + position); pager.setCurrentItem(position); } }); tab.setPadding(tabPadding, 0, tabPadding, 0); tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); }
From source file:com.aniruddhc.acemusic.player.MusicLibraryEditorActivity.MusicLibraryEditorActivity.java
@SuppressWarnings("unchecked") @Override/* ww w .ja v a 2 s .c o m*/ public void onCreate(Bundle savedInstanceState) { //Initialize Context and SharedPreferences. mContext = this; mApp = (Common) mContext.getApplicationContext(); //Retrieve the name/icon of the library from the arguments. libraryName = getIntent().getExtras().getString("LIBRARY_NAME"); libraryIconName = getIntent().getExtras().getString("LIBRARY_ICON"); if (getIntent().getExtras().getSerializable("SONG_IDS_HASH_SET") != null) { songDBIdsList = (HashSet<String>) getIntent().getExtras().getSerializable("SONG_IDS_HASH_SET"); } //Set the UI theme. if (mApp.getCurrentTheme() == Common.DARK_THEME) { setTheme(R.style.AppTheme); } else { setTheme(R.style.AppThemeLight); } super.onCreate(savedInstanceState); //Initialize the database helper. dbHelper = new DBAccessHelper(mContext.getApplicationContext()); //Create a set of options to optimize the bitmap memory usage. final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; options.inJustDecodeBounds = false; options.inPurgeable = true; //Display Image Options. int defaultArt = UIElementsHelper.getIcon(mContext, "default_album_art_padded"); displayImageOptions = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.default_album_art) .showImageOnFail(R.drawable.default_album_art).showStubImage(R.drawable.transparent_drawable) .cacheInMemory(false).cacheOnDisc(true).decodingOptions(options) .imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565) .displayer(new FadeInBitmapDisplayer(400)).delayBeforeLoading(100).build(); //Attach tabs to the ActionBar. ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); //Add the artists tab. String artistsLabel = getResources().getString(R.string.artists); Tab tab = actionBar.newTab(); tab.setText(artistsLabel); TabListener<ArtistsPickerFragment> artistsTabListener = new TabListener<ArtistsPickerFragment>(this, artistsLabel, ArtistsPickerFragment.class); tab.setTabListener(artistsTabListener); actionBar.addTab(tab); //Add the albums tab. String albumsLabel = getResources().getString(R.string.albums); tab = actionBar.newTab(); tab.setText(albumsLabel); TabListener<AlbumsPickerFragment> albumsTabListener = new TabListener<AlbumsPickerFragment>(this, albumsLabel, AlbumsPickerFragment.class); tab.setTabListener(albumsTabListener); actionBar.addTab(tab); //Add the songs tab. String songsLabel = getResources().getString(R.string.songs); tab = actionBar.newTab(); tab.setText(songsLabel); TabListener<SongsPickerFragment> songsTabListener = new TabListener<SongsPickerFragment>(this, songsLabel, SongsPickerFragment.class); tab.setTabListener(songsTabListener); actionBar.addTab(tab); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { getWindow().setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext)); int topPadding = Common.getStatusBarHeight(mContext); View activityView = (View) findViewById(android.R.id.content); //Calculate ActionBar height TypedValue tv = new TypedValue(); int actionBarHeight = 0; if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) { actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics()); } if (activityView != null) { activityView.setPadding(0, topPadding + actionBarHeight, 0, 0); } } }
From source file:com.szhr.noname.view.PagerSlidingTabStrip.java
private void addTab(final int position, View tab) { tab.setFocusable(true);/* w w w . j a va 2s . c o m*/ tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pager.setCurrentItem(position); } }); tab.setPadding(tabPadding, 0, tabPadding, 0); // setShouldExpand(true); if (tab instanceof TextView) { if (position == 0) { //!!! tab ((TextView) tab).setTextColor(tabSelectedTextColor); } else { //!!! tab ((TextView) tab).setTextColor(tabTextColor); } } tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); }
From source file:org.appcelerator.titanium.util.TiUIHelper.java
public static void setPadding(final View view, final RectF padding) { view.setPadding((int) padding.left, (int) padding.top, (int) padding.right, (int) padding.bottom); }
From source file:com.homechart.app.commont.matertab.MaterialTabs.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setPadding(tabPadding, v.getPaddingTop(), tabPadding, v.getPaddingBottom()); TextView tab_title = (TextView) v.findViewById(R.id.mt_tab_title); if (tab_title != null) { tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab_title.setTextColor(tabTextColorUnselected); // 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_title.setAllCaps(true); } else { tab_title.setText(tab_title.getText().toString().toUpperCase(locale)); }// w w w .j a va 2 s . co m } } } }
From source file:com.lpii.evma.view.organizer.PagerSlidingTabStripEv.java
private void addTab(final int position, View tab) { tab.setFocusable(true);/*w w w .j a v a 2 s . c o m*/ tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { System.out.println("position " + position); pager.setCurrentItem(position); } }); tab.setPadding(tabPadding, 0, tabPadding, 0); tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); }
From source file:com.app.gongza.libs.view.tabstrip.PagerSlidingTabStrip.java
private void addTab(final int position, View tab) { tab.setFocusable(true);//from w w w. j a v a 2s . c om tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showTabClick(position); pager.setCurrentItem(position); } }); tab.setPadding(tabPadding, 0, tabPadding, 0); tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); }
From source file:com.bowen.hannengclub.view.PagerSlidingTabStrip.java
private void addTab(final int position, View tab) { tab.setFocusable(true);//w w w . j a v a2 s .c om tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pager.setCurrentItem(position); } }); tab.setPadding(tabPadding, 0, tabPadding, 0); /*// XXX ?? int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); tab.measure(w, h); int height = tab.getMeasuredHeight(); int width = tab.getMeasuredWidth(); // ?? WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); int screenWidth = wm.getDefaultDisplay().getWidth(); width = screenWidth / pager.getAdapter().getCount(); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width,height); tab.setLayoutParams(params);//tab??*/ // ? defaultTabLayoutParams.weight = 1.0f; expandedTabLayoutParams.weight = 1.0f; tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); }
From source file:com.qhzlwh.yigua.view.PagerTab.java
private void addTab(final int position, View tab) { tab.setFocusable(true);/*from w ww . java 2 s . c o m*/ tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pager.setCurrentItem(position, false); updateTabStyles(); } }); tab.setPadding(tabPadding, 0, tabPadding, 0); addView(tab, position, this.shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); }