We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.app.FragmentTransaction; import android.support.v4.app.ListFragment; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.Toast;
import com.gigamole.navigationtabstrip.NavigationTabStrip;
public class MainActivity extends AppCompatActivity {
private NavigationTabStrip mCenterNavigationTabStrip; private FrameLayout frameLayout; private ViewPager mViewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); mCenterNavigationTabStrip = (NavigationTabStrip) findViewById(R.id.nts_center); mViewPager = (ViewPager) findViewById(R.id.vp); toolbar.setTitleTextColor(G.context.getResources().getColor(R.color.item)); frameLayout = (FrameLayout) findViewById(R.id.farmlayout); setUI(); mCenterNavigationTabStrip.setViewPager(mViewPager); mCenterNavigationTabStrip.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { // Toast.makeText(G.context, "positon =" + position, Toast.LENGTH_SHORT).show(); mViewPager.setCurrentItem(position); // Toast.makeText(G.context, "positon =" + mViewPager.getCurrentItem(), Toast.LENGTH_SHORT).show(); } @Override public void onPageScrollStateChanged(int state) { } }); mCenterNavigationTabStrip.setOnTabStripSelectedIndexListener(new NavigationTabStrip.OnTabStripSelectedIndexListener() { @Override public void onStartTabSelected(String title, int index) { mViewPager.setCurrentItem(index); Toast.makeText(G.context, "viewpager =" + mViewPager.getCurrentItem() + "index " + index , Toast.LENGTH_SHORT).show(); } @Override public void onEndTabSelected(String title, int index) { } }); } @Override public boolean onSupportNavigateUp() { onBackPressed(); return true; } private void setUI() { mViewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) { @Override public Fragment getItem(int position) { switch (position) { case 0: return new loginFragment(); case 1: return new signupFragment(); default: return null; } } @Override public int getCount() { return 2; } }); }
}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.ListFragment;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.Toast;
import com.gigamole.navigationtabstrip.NavigationTabStrip;
public class MainActivity extends AppCompatActivity {
}
The text was updated successfully, but these errors were encountered: