List of usage examples for android.view View setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:com.cereuswomen.marketingmessage.view.SlidingTabLayout.java
public void populateTabStrip(int position) { final FragmentPagerAdapter adapter = (FragmentPagerAdapter) mViewPager.getAdapter(); final View.OnClickListener tabClickListener = new TabClickListener(); for (int i = position; i < adapter.getCount(); i++) { View tabView = null; TextView tabTitleView = null;// w w w . ja va 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)); tabView.setOnClickListener(tabClickListener); mTabStrip.addView(tabView); } }
From source file:br.com.luizgadao.selfdestruction.views.android.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final View.OnClickListener tabClickListener = new TabClickListener(); //custom width int customW = getResources().getDisplayMetrics().widthPixels / mViewPager.getAdapter().getCount(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null; TextView tabTitleView = null;//w w w .ja v 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)); tabView.setOnClickListener(tabClickListener); //set custom width for tabview tabView.setMinimumWidth(customW); mTabStrip.addView(tabView); } }
From source file:com.android.calendar.event.EditEventFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // mContext.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); View view;//from w w w .j a v a 2s .co m if (mIsReadOnly) { view = inflater.inflate(R.layout.edit_event_single_column, null); } else { view = inflater.inflate(R.layout.edit_event, null); } mView = new EditEventView(mContext, view, mOnDone, mTimeSelectedWasStartTime, mDateSelectedWasStartDate); if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_CALENDAR) != PackageManager.PERMISSION_GRANTED) { //If permission is not granted Toast.makeText(mContext, R.string.calendar_permission_not_granted, Toast.LENGTH_LONG).show(); } else { startQuery(); } if (mUseCustomActionBar) { View actionBarButtons = inflater.inflate(R.layout.edit_event_custom_actionbar, new LinearLayout(mContext), false); View cancelActionView = actionBarButtons.findViewById(R.id.action_cancel); cancelActionView.setOnClickListener(mActionBarListener); View doneActionView = actionBarButtons.findViewById(R.id.action_done); doneActionView.setOnClickListener(mActionBarListener); mContext.getSupportActionBar().setCustomView(actionBarButtons); } return view; }
From source file:com.bei.test.view.tab.PagerSlidingTabStrip.java
private void addTab(final int position, CharSequence title, View tabView) { TextView textView = (TextView) tabView.findViewById(R.id.psts_tab_title); if (textView != null) { if (title != null) textView.setText(title);//from www .j av a 2 s . c om } tabView.setFocusable(true); tabView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mPager.getCurrentItem() != position) { View tab = mTabsContainer.getChildAt(mPager.getCurrentItem()); unSelect(tab); mPager.setCurrentItem(position); } else if (mTabReselectedListener != null) { mTabReselectedListener.onTabReselected(position); } } }); mTabsContainer.addView(tabView, position, mTabLayoutParams); }
From source file:atom.mobile.lib.slidedate.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null; TextView tabTitleView = null;// w ww .j a v a2 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)); tabView.setOnClickListener(tabClickListener); // Used to get a reference to each tab's TextView in order to // update the text in setTabText(). mTabTitleViews.put(i, tabTitleView); mTabStrip.addView(tabView); } }
From source file:cn.archko.pdf.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null; TextView tabTitleView = null;//from w w w. j a v a2s .com 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)); tabView.setOnClickListener(tabClickListener); if (!isMatchWidth) { mTabStrip.addView(tabView); } else { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams(); if (lp == null) { lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 1); } mTabStrip.addView(tabView, lp); } } }
From source file:com.common.view.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 ava 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; } assert tabTitleView != null; tabTitleView.setText(adapter.getPageTitle(i)); tabView.setOnClickListener(tabClickListener); mTabStrip.addView(tabView); } }
From source file:com.cloudvision.tanzhenv2.order.tabLayout.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null; TextView tabTitleView = null;//from ww w . j a v a 2s . c om 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; } if (tabTitleView != null) tabTitleView.setText(adapter.getPageTitle(i)); tabView.setOnClickListener(tabClickListener); mTabStrip.addView(tabView); } }
From source file:com.co.iatech.crm.sugarmovil.activities.ui.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;/* w ww .j a va 2 s.co m*/ if (mTabViewLayoutId != 0) { tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false); tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId); Log.d("TABS", " Ingresa por TabLayout id"); } if (tabView == null) { tabView = createDefaultTabView(getContext()); Log.d("TABS", " Ingresa por TabView Null"); } if (tabTitleView == null && TextView.class.isInstance(tabView)) { tabTitleView = (TextView) tabView; } tabTitleView.setText(adapter.getPageTitle(i)); tabView.setOnClickListener(tabClickListener); mTabStrip.addView(tabView); if (i == mViewPager.getCurrentItem()) { tabView.setSelected(true); } } }
From source file:SwipeListViewTouchListener.java
/** * Set current item's back view//from ww w . j a va 2 s. c om * * @param backView */ private void setBackView(View backView) { this.backView = backView; backView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { swipeListView.onClickBackView(downPosition); } }); }