zoukankan      html  css  js  c++  java
  • 2017.1-TOP5 Android开源库

    Colorful (Github)

    Colorful简单实用,通过这个开源库可以通过编码的方式来改变应用的主题,不再需要定义不同的style

    dependencies {
        compile 'com.github.garretyoder:Colorful:1.1'
    }
    public class SampleApp extends Application {
        @Override
        public void onCreate() {
            super.onCreate();
            Colorful.init(this);
        }
    }

    你需要改变主题的Activity必须继承CActivity

    public class MainActivity extends CActivity

    或者在 setContentView()之前调用下面的方法

    Colorful.applyTheme(Activity activity);

    也可以调用 Colorful.applyTheme(Activity activity, Boolean overrideBase); 参数 overrideBase 说明是否要覆盖本身的主题

    可以在初始化时,设置默认的主题

    public class SampleApp extends Application {
        @Override
        public void onCreate() {
            super.onCreate();
            Colorful.defaults()
                    .primaryColor(Colorful.ThemeColor.RED)
                    .accentColor(Colorful.ThemeColor.BLUE)
                    .translucent(false)
                    .dark(true);
            Colorful.init(this);
        }
    }

    在代码中可以使用配置随时修改

    Colorful.config(this)
                    .primaryColor(Colorful.ThemeColor.RED)
                    .accentColor(Colorful.ThemeColor.BLUE)
                    .translucent(false)
                    .dark(true)
                    .apply();

    Stencil (Github)

    是时候给你的文字来点花样了

    dependencies {
      compile 'com.github.thoughtbot:stencil:1.0'
    }

    WaveLoading (Github)

    波浪形动画

    compile 'com.race604.waveloading:library:1.1.1'

    使用

    Drawable mWaveDrawable = new WaveDrawable(otherDrawable);
    
    // Use as common drawable
    imageView.setImageDrawable(mWaveDrawable);

    其他的配置方法

    public void setWaveAmplitude(int amplitude), set wave amplitude (in pixels)
    public void setWaveLength(int length), set wave length (in pixels)
    public void setWaveSpeed(int step), set wave move speed (in pixels)
    public void setIndeterminate(boolean indeterminate), like progress bar, if run in indeterminate mode, it'll increase water level over and over again, otherwise, you can use boolean setLevel(int level) to set the water level, acting as loading progress.
    public void setIndeterminateAnimator(ValueAnimator animator), set you customised animator for wave loading animation in indeterminate mode.

    BufferTextInputLayout (Github)

    一个简单的定制化的TextInputLayout

    <org.buffer.android.buffertextinputlayout.BufferTextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:counterEnabled="true"
            app:counterMaxLength="10"
            app:counterOverflowTextAppearance="@style/counterOverride"
            app:counterTextAppearance="@style/counterText"
            app:hintEnabled="true"
            app:counterMode="ascending">
    
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/text_hint" />
    
    </org.buffer.android.buffertextinputlayout.BufferTextInputLayout>



    PageLoader (Github)

    定制页面加载的一个开源库

    dependencies {
        compile 'id.arieridwan:pageloader:0.0.2'
    }
    <id.arieridwan.lib.PageLoader
        android:id="@+id/pageloader"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    SomeMethod(){
    pageLoader.startProgress();
    ...
        onComplete(){
            ...
        }
        onNext(){
            ...
            pageLoader.stopProgress();
        }
        onError(){
            ...
            pageLoader.stopProgressAndFailed();
        }
    }

    原文

  • 相关阅读:
    修改MFC标题栏上的图标
    【转】子窗口刷新父窗口的问题
    水晶报表添加引用
    【转】MetadataType的使用,MVC的Model层数据验证
    poj 1556 The Doors 线段相交判断+最短路
    poj 1269 Intersecting Lines 求直线交点 判断直线平行共线
    string 函数操作
    poj 1066 Treasure Hunt 线段相交判断
    poj 1410 Intersection 线段相交判断
    poj 3347 Kadj Squares 扩大数据化整数
  • 原文地址:https://www.cnblogs.com/Free-Thinker/p/6627347.html
Copyright © 2011-2022 走看看