效果主要靠布局来实现的,主要使用了CoordinatorLayout+AppBarLayout+CollapsingToolbarLayout

<?xml version="1.0" encoding="utf-8"?>.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical">    .support.design.widget.AppBarLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:theme="@style/AppTheme.AppBarOverlay">        .support.design.widget.CollapsingToolbarLayout            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:fitsSystemWindows="true"            app:contentScrim="?attr/colorPrimary"            app:layout_collapseMode="parallax"            app:layout_collapseParallaxMultiplier="0.7"            app:layout_scrollFlags="scroll|exitUntilCollapsed">            "match_parent"                android:layout_height="match_parent"                android:src="@drawable/wenyi" />        .support.design.widget.CollapsingToolbarLayout>                .support.design.widget.TabLayout            android:id="@+id/tablayout"            android:layout_width="match_parent"            android:layout_height="wrap_content">        .support.design.widget.TabLayout>    .support.design.widget.AppBarLayout>    .support.v4.widget.NestedScrollView        android:layout_width="match_parent"        android:layout_height="wrap_content"      app:layout_behavior="@string/appbar_scrolling_view_behavior">        "match_parent"            android:layout_height="wrap_content"            android:text="@string/str"            android:textSize="20sp" />    .support.v4.widget.NestedScrollView>.support.design.widget.CoordinatorLayout>

Activity里面主要就是对TabLayout 的设置

 private TabLayout mTabLayout;    @Override    protected void onCreate(@Nullable Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_coor);        mTabLayout= (TabLayout) findViewById(R.id.tablayout);        mTabLayout.addTab(mTabLayout.newTab().setText("分类"));        mTabLayout.addTab(mTabLayout.newTab().setText("排序"));        mTabLayout.addTab(mTabLayout.newTab().setText("价格"));        mTabLayout.setTabTextColors(Color.BLACK,Color.RED);        mTabLayout.setSelectedTabIndicatorColor(Color.RED);        mTabLayout.setBackgroundColor(Color.GREEN);    }

更多相关文章

  1. TextView跑马灯效果
  2. 背景图片颜色渐变
  3. Android(安卓)View.startAnimation()动画
  4. Android(安卓)--- 图片的特效处理
  5. android启动和推出实现侧滑效果
  6. android酷炫翻页效果+图形分析
  7. 【Android(安卓)Studio】 Caused by: java.lang.ClassNotFoundEx
  8. 浅谈Java中Collections.sort对List排序的两种方法
  9. Python list sort方法的具体使用

随机推荐

  1. 牛逼的Android(安卓)UI
  2. Android笔记(1)adb的使用
  3. android 内存溢出oom错误的一些小见解
  4. Android(安卓)一个强大实用的版本升级dem
  5. android跳转QQ陌生人聊天或者加入QQ群
  6. android在原来的view上画边框或者其它内
  7. Android(安卓)Studio教程06-快捷键、Debu
  8. Android培训班(19)
  9. Android(安卓)Studio项目混淆后输出的文
  10. android 流量监控类TrafficStas