80,359
社区成员
发帖
与我相关
我的任务
分享
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_firstpager_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!--标题界面-->
<LinearLayout
android:id="@+id/fragment_firstpager_title"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/title_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_scrollFlags="scroll|enterAlways">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="13dp"
android:src="@drawable/logo" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<ImageView
android:id="@+id/fragment_firstpager_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/xiaoxi" />
<View
android:layout_width="23dp"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/fragment_firstpager_record"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/jilu" />
<View
android:layout_width="23dp"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/fragment_firstpager_scan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/saoyisao" />
<View
android:layout_width="13dp"
android:layout_height="match_parent" />
</LinearLayout>
<!--tab和导航-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#EBEBEB">
<android.support.design.widget.TabLayout
android:id="@+id/fragment_firstpager_tablayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
app:tabGravity="center"
app:tabIndicatorColor="@color/tab_select"
app:tabMode="scrollable"
app:tabSelectedTextColor="@color/tab_select">
</android.support.design.widget.TabLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/elevation" />
<!--导航-->
<LinearLayout
android:id="@+id/fragment_firstpager_guide"
android:layout_width="50dp"
android:layout_height="50dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/daohang" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="导航" />
</LinearLayout>
</LinearLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/fragment_firstpager_viewpager"
android:layout_width="match_parent"
android:layout_height="3000dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</android.support.v4.view.ViewPager>
</android.support.design.widget.CoordinatorLayout>
@Override
public View initView(Activity activity) {
View view = LayoutInflater.from(activity).inflate(R.layout.fragment_firstpager2,container,false);
fragment_firstpager_message = (ImageView) view.findViewById(R.id.fragment_firstpager_message);
fragment_firstpager_record = (ImageView) view.findViewById(R.id.fragment_firstpager_record);
fragment_firstpager_scan = (ImageView) view.findViewById(R.id.fragment_firstpager_scan);
fragment_firstpager_tablayout = (TabLayout) view.findViewById(R.id.fragment_firstpager_tablayout);
fragment_firstpager_guide = (LinearLayout) view.findViewById(R.id.fragment_firstpager_guide);
fragment_firstpager_viewpager = (ViewPager) view.findViewById(R.id.fragment_firstpager_viewpager);
haveStateScrollView = (CoordinatorLayout) view.findViewById(R.id.fragment_firstpager_scrollview);
fragment_firstpager_title = (LinearLayout) view.findViewById(R.id.fragment_firstpager_title);
return view;
}
@Override
protected void initListener(Activity activity) {
}
@Override
public void initDate(Activity activity) {
BaseActivityPagerAdapter pagerAdapter = new BaseActivityPagerAdapter(((MainActivity) activity).getSupportFragmentManager());
Bundle bundle = new Bundle();
pagerAdapter.addData(activity, pagerAdapter.new FragmentInfo(RecommandFragment.class, bundle), "推荐");
pagerAdapter.addData(activity, pagerAdapter.new FragmentInfo(FreeClassFragment.class, bundle), "免费课");
pagerAdapter.addData(activity, pagerAdapter.new FragmentInfo(ChooseClassFragment.class, bundle), "选课程");
pagerAdapter.addData(activity, pagerAdapter.new FragmentInfo(SeeLiveFragment.class, bundle), "看直播");
pagerAdapter.addData(activity, pagerAdapter.new FragmentInfo(OneMoneyFragment.class, bundle), "一元课");
pagerAdapter.addData(activity, pagerAdapter.new FragmentInfo(SubjectFragment.class, bundle), "专题");
fragment_firstpager_viewpager.setAdapter(pagerAdapter);
fragment_firstpager_tablayout.setupWithViewPager(fragment_firstpager_viewpager);
}