效果主要靠布局来实现的,主要使用了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. android启动和推出实现侧滑效果
  2. Android 滑动效果代码分享
  3. Android之给图片添加水印效果
  4. android表格效果--ListView隔行变色
  5. android动态布局方法总结
  6. android短信窃听器,娱乐版,效果可以实现
  7. Android——布局的一些动态设置

随机推荐

  1. android画笔移位解决
  2. 关于手机网页viewpoint缩放适配各种机型
  3. Android(安卓)实现截屏和截长图功能的几
  4. 偷师阿里内部,月入20k程序员的Android规范
  5. 关于在使用gson解析json时建模与规范冲突
  6. 强指针和弱指针
  7. Android(安卓)JSON解析库Gson和Fast-json
  8. Android(安卓)总结:Manifest文件中,applic
  9. 修改Android的编译文件使其支持wml
  10. 手把手教你如何封装一个通用的 App SDK