GitHub开源控件的使用合集

Android的加载动画AVLoadingIndicatorView

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

项目地址:

https://github.com/81813780/AVLoadingIndicatorView

首先,在 build.gradle.中添加;

  dependencies {
       compile 'com.wang.avi:library:2.1.3'
    }

然后在xml中使用;

 <com.wang.avi.AVLoadingIndicatorView
        android:id="@+id/avi"
        android:layout_width="wrap_content"  //or your custom size
        android:layout_height="wrap_content"  //or your custom size
        style="@style/AVLoadingIndicatorView"// or AVLoadingIndicatorView.Large or                  
        AVLoadingIndicatorView.Small
        android:visibility="visible"  //visible or gone
        app:indicatorName="BallPulseIndicator"//Indicator Name
        app:indicatorColor="your color"
        />

也可以通过代码显示或者隐藏;

 void startAnim(){
        avi.show();
        // or avi.smoothToShow();
   }

   void stopAnim(){
        avi.hide();
        // or avi.smoothToHide();
   }

QuantityView 类似购物车数量调节:

效果图:

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

项目在GitHub上的地址:

https://github.com/himanshu-soni/QuantityView

项目使用:

在gradle中添加

compile 'me.himanshusoni.quantityview:quantity-view:1.1.3'

在XML中添加布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/md_white_1000"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Default"
        android:textAppearance="?android:textAppearanceLarge" />

    <me.himanshusoni.quantityview.QuantityView
        android:id="@+id/quantityView_default"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        app:qv_quantity="10" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:text="Custom 1"
        android:textAppearance="?android:textAppearanceLarge" />

    <me.himanshusoni.quantityview.QuantityView
        android:id="@+id/quantityView_custom_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        app:qv_addButtonText="ADD MORE"
        app:qv_addButtonTextColor="@color/md_green_500"
        app:qv_maxQuantity="20"
        app:qv_quantity="15"
        app:qv_removeButtonText="REMOVE"
        app:qv_removeButtonTextColor="@color/md_red_500" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:text="Custom 2"
        android:textAppearance="?android:textAppearanceLarge" />

    <me.himanshusoni.quantityview.QuantityView
        android:id="@+id/quantityView_custom_2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        app:qv_addButtonBackground="@drawable/add_selector"
        app:qv_addButtonTextColor="@color/md_white_1000"
        app:qv_quantity="20"
        app:qv_removeButtonBackground="@drawable/remove_selector"
        app:qv_removeButtonTextColor="@color/md_white_1000" />


</LinearLayout>

Java中的使用代码:

public class SlideDateTimeActivity extends FragmentActivity {

    @Bind(R.id.button)
    Button button;

    private SimpleDateFormat mFormatter = new SimpleDateFormat("MMMM dd yyyy hh:mm aa");
    private Button mButton;

    private SlideDateTimeListener listener = new SlideDateTimeListener() {

        @Override
        public void onDateTimeSet(Date date) {
            Toast.makeText(SlideDateTimeActivity.this,
                    mFormatter.format(date), Toast.LENGTH_SHORT).show();
        }

        // Optional cancel listener
        @Override
        public void onDateTimeCancel() {
            Toast.makeText(SlideDateTimeActivity.this,
                    "Canceled", Toast.LENGTH_SHORT).show();
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_slide_date_time_picker);
        ButterKnife.bind(this);
        button.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                new SlideDateTimePicker.Builder(getSupportFragmentManager())
                        .setListener(listener)
                        .setInitialDate(new Date())
                        //.setMinDate(minDate)
                        //.setMaxDate(maxDate)
                        //.setIs24HourTime(true)
                        //.setTheme(SlideDateTimePicker.HOLO_DARK)
                        //.setIndicatorColor(Color.parseColor("#990000"))
                        .build()
                        .show();
            }
        });
    }

}


Justified 实现Textview和Edittext文字左右对齐。

效果图:
外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

项目在GitHub上的地址:

https://github.com/programingjd/justified

项目使用:

在gradle中添加

compile 'com.uncopt:android.justified:1.0'

在XML中添加布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.zerom.mtest.Justifiedtextview">

    <me.biubiubiu.justifytext.library.JustifyTextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/margin_20"
        android:text="预览版目前已经包括Android Wear最新API,这些新API可以让开发者以语音的方式定制和扩展他们的通知。其提供的仿真器可用于预览包括方形和圆形可穿戴设备上出现的通知方式,与此同时,谷歌也希望在未来几个月内继续为Android Wear设备提供新的API和功能。" />

    <me.biubiubiu.justifytext.library.JustifyTextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/margin_20"
        android:text="Tests whether this string matches the given regularExpression. This method returns true only if the regular expression matches the entire input string. A common mistake is to assume that this method behaves like contains(CharSequence); if you want to match anywhere within the input string, you need to add .* to the beginning and end of your regular expression. See matches(String, CharSequence)." />

</LinearLayout>

android-shapeLoadingView实现高仿新版58 加载动画

效果图:
外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

项目在GitHub上的地址:

https://github.com/zzz40500/android-shapeLoadingView

项目使用:

在gradle中添加

compile 'com.github.zzz40500:android-shapeLoadingView:1.0.3.2'

在XML中添加布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".ShapeLoadingctivity">

    <com.mingle.widget.LoadingView
        android:id="@+id/loadView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        app:loadingText="加载中..." />

</RelativeLayout>


SlideDateTimePicker实现时间选择器,可以选择年月日小时分钟

效果图:
外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

项目在GitHub上的地址:

https://github.com/jjobes/SlideDateTimePicker

项目使用:

添加依赖包;

Java中的使用代码:

public class SlideDateTimeActivity extends FragmentActivity {

    @Bind(R.id.button)
    Button button;

    private SimpleDateFormat mFormatter = new SimpleDateFormat("MMMM dd yyyy hh:mm aa");
    private Button mButton;

    private SlideDateTimeListener listener = new SlideDateTimeListener() {

        @Override
        public void onDateTimeSet(Date date) {
            Toast.makeText(SlideDateTimeActivity.this,
                    mFormatter.format(date), Toast.LENGTH_SHORT).show();
        }

        // Optional cancel listener
        @Override
        public void onDateTimeCancel() {
            Toast.makeText(SlideDateTimeActivity.this,
                    "Canceled", Toast.LENGTH_SHORT).show();
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_slide_date_time_picker);
        ButterKnife.bind(this);
        button.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                new SlideDateTimePicker.Builder(getSupportFragmentManager())
                        .setListener(listener)
                        .setInitialDate(new Date())
                        //.setMinDate(minDate)
                        //.setMaxDate(maxDate)
                        //.setIs24HourTime(true)
                        //.setTheme(SlideDateTimePicker.HOLO_DARK)
                        //.setIndicatorColor(Color.parseColor("#990000"))
                        .build()
                        .show();
            }
        });
    }

}

Labelview实现标签功能,在控件上面展示斜的文字

效果图:
外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

项目在GitHub上的地址:

https://github.com/linger1216//labelview

项目使用:

在gradle中添加

compile 'com.github.linger1216:labelview:v1.1.0'

在XML中添加布局:

<ScrollView 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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity">


    <LinearLayout
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:layout_height="wrap_content">

        <com.lid.lib.LabelButtonView
            android:id="@+id/labelbutton"
            android:layout_width="200dp"
            android:layout_height="48dp"
            android:background="#03a9f4"
            android:gravity="center"
            android:text="Button"
            android:textColor="#ffffff"
            app:label_backgroundColor="#C2185B"
            app:label_distance="20dp"
            app:label_height="20dp"
            app:label_orientation="RIGHT_TOP"
            app:label_text="HD"
            app:label_textSize="12sp" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="24dp">

            <com.lid.lib.LabelImageView
                android:id="@+id/image1"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:scaleType="centerCrop"
                android:src="@mipmap/image1"
                app:label_backgroundColor="#C2185B"
                app:label_orientation="LEFT_TOP"
                app:label_text="CHINA" />


            <com.lid.lib.LabelImageView
                android:id="@+id/image2"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:scaleType="centerCrop"
                android:src="@mipmap/image2"
                app:label_backgroundColor="#C2185B"
                app:label_orientation="RIGHT_TOP"
                app:label_text="KUNQU" />
        </LinearLayout>


        <com.lid.lib.LabelTextView
            android:id="@+id/text"
            android:layout_width="wrap_content"
            android:layout_height="48dp"
            android:layout_gravity="center"
            android:layout_marginTop="8dp"
            android:background="#212121"
            android:gravity="center"
            android:padding="16dp"
            android:text="TextView"
            android:textColor="#ffffff"
            app:label_backgroundColor="#03A9F4"
            app:label_distance="15dp"
            app:label_orientation="LEFT_TOP"
            app:label_text="POP"
            app:label_textSize="10sp" />


        <com.lid.lib.LabelButtonView
            android:id="@+id/click"
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="8dp"
            android:background="#E91E63"
            android:gravity="center"
            android:text="ListView
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值