平方X 发表于 2015-7-10 16:12:59

Fragment+viewpager+radiobutton

写完了发现不想用滑动的效果,再改了。
在布局中,用radiogroup,radiobutton,viewpager即可。Main_Activity extends FragmentActivity,viewpager.setOnPageChangeListener,转至radiogroup.setOnCheckedChangeListener
ViewPager.setCurrentItem();

LXMallFragmentAdapter xxlFragmentAdapter=new LXMallFragmentAdapter(this.getSupportFragmentManager());
xxmViewPager.setAdapter(xxlFragmentAdapter);


在fragmetnadapter中实现getCount和getItem,
return new LXMall_Home_Fragment();

public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
        return inflater.inflate(R.layout.lxactivity_mall_home, container, false);
}

页: [1]
查看完整版本: Fragment+viewpager+radiobutton