美文网首页开源库挖掘&推荐
头部可缩放的布局 | ScalingLayout

头部可缩放的布局 | ScalingLayout

作者: 5afd372c86ba | 来源:发表于2017-10-16 22:51 被阅读5次
    名称 ScalingLayout
    语言 Android
    平台 GitHub
    作者 iammert
    链接 点此进入
    备注 更多精彩开源库推荐请访问明灯小站

    该布局支持布局头部可缩放,在一些资讯类的APP会经常用到。
    效果图

    效果图
    使用方法
    1. 添加依赖
    maven { url 'https://jitpack.io' }
    
    dependencies {
      compile 'com.github.iammert:ScalingLayout:1.1'
    }
    
    1. 在xml布局添加控件
    <iammert.com.view.scalinglib.ScalingLayout
            android:id="@+id/scalingLayout"
            android:layout_width="300dp"
            android:layout_height="48dp"
            app:radiusFactor="1">
            
            <!-- Your content here -->
            
    </iammert.com.view.scalinglib.ScalingLayout>
    
    1. Java代码设置
    scalingLayout.expand(); //use this if you want to expand all
    scalingLayout.collapse(); //user this if you want to collapse view to initial state.
    scalingLayout.setProgress(float progress); //1 is fully expanded, 0 is initial state.
    
    scalingLayout.setListener(new ScalingLayoutListener() {
        @Override
        public void onCollapsed() {}
    
        @Override
        public void onExpanded() {}
    
        @Override
        public void onProgress(float progress) {}
    });
    

    更多使用方法请参考其GitHub。

    相关文章

      网友评论

        本文标题:头部可缩放的布局 | ScalingLayout

        本文链接:https://www.haomeiwen.com/subject/qvtruxtx.html