material design 的android开源代码整理

https://github.com/navasmdc/MaterialDesignLibrary#progress-bar-indeterminate-determinate

Material Design Android Library

How to use

If you want use this library, you only have to download MaterialDesign project, import it into your workspace and add the project as a library in your android project settings.

If you prefer it, you can use the gradle dependency, you have to add these lines in your build.gradle file:

repositories {
    jcenter()
}

dependencies {
    compile ‘com.github.navasmdc:MaterialDesign:[email protected]‘
}

Some components have custom attributes, if you want use them, you must add this line in your xml file in the first component:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
</RelativeLayout>

If you are going to use a ScrollView, it is recommended that you use the CustomScrollView provided in this library to avoid problems with the custom components. To use this component:

<com.gc.materialdesign.views.ScrollView
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
   android:id="@+id/scroll"
   android:layout_width="match_parent"
   android:layout_height="match_parent">
</com.gc.materialdesign.views.ScrollView>

##Components

####Buttons

######Flat Button

<com.gc.materialdesign.views.ButtonFlat
                android:id="@+id/buttonflat"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#1E88E5"
                android:text="Button" />

######Rectangle Button

<com.gc.materialdesign.views.ButtonRectangle
                android:id="@+id/button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#1E88E5"
                android:text="Button" />

######Float Button

It is recommended to put this component in the right-bottom of the screen. To use this component write this code in your xml file. If you don`t want to start this component with animation set the animate attribute to false. Put your icon in the icon attribute to set the drawable icon for this component.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <!-- ... XML CODE -->
    <com.gc.materialdesign.views.ButtonFloat
                android:id="@+id/buttonFloat"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_alignParentBottom="true"
                android:layout_marginRight="24dp"
                android:background="#1E88E5"
                materialdesign:animate="true"
                materialdesign:iconDrawable="@drawable/ic_action_new" />
</RelativeLayout>

######Float small button

<com.gc.materialdesign.views.ButtonFloatSmall
                android:id="@+id/buttonFloatSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#1E88E5"
                materialdesign:iconDrawable="@drawable/ic_action_new" />

####Switches

######CheckBox

<com.gc.materialdesign.views.CheckBox
                android:id="@+id/checkBox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#1E88E5"
                materialdesign:check="true" />

######Switch

<com.gc.materialdesign.views.Switch
                android:id="@+id/switchView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#1E88E5"
                materialdesign:check="true" />

####Progress indicators

######Progress bar circular indeterminate

<com.gc.materialdesign.views.ProgressBarCircularIndeterminate
                android:id="@+id/progressBarCircularIndeterminate"
                android:layout_width="32dp"
                android:layout_height="32dp"
                android:background="#1E88E5" />

######Progress bar indeterminate

<com.gc.materialdesign.views.ProgressBarIndeterminate
                android:id="@+id/progressBarIndeterminate"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:background="#1E88E5" />

######Progress bar indeterminate determinate

<com.gc.materialdesign.views.ProgressBarIndeterminateDeterminate
                android:id="@+id/progressBarIndeterminateDeterminate"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:background="#1E88E5" />

If you begin progrees, you only have to set progress it

progressBarIndeterminateDeterminate.setProgress(progress);

######Progress bar determinate

<com.gc.materialdesign.views.ProgressBarDeterminate
                android:id="@+id/progressDeterminate"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:background="#1E88E5" />

You can custom max and min progress values with materialdesign:max="50" and materialdesign:min="25" attributes.

######Slider

<com.gc.materialdesign.views.Slider
                android:id="@+id/slider"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:background="#1E88E5"
                materialdesign:max="50"
                materialdesign:min="0"
                 />

######Slider with number indicator

<com.gc.materialdesign.views.Slider
                android:id="@+id/slider"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:background="#1E88E5"
                materialdesign:max="50"
                materialdesign:min="0"
                materialdesign:showNumberIndicator="true"/>

##Widgets

####SnackBar

SnackBar snackbar = new SnackBar(Activity activity, String text, String buttonText, View.OnClickListener onClickListener);
snackbar.show();

If you don‘t want to show the button, put null in buttonText attribute

####Dialog

Dialog dialog = new Dialog(Context context,String title, String message);
dialog.show();

You can set the accept and cancel button on the event listener or change it‘s text

// Set accept click listenner
dialog.setOnAcceptButtonClickListener(View.OnClickListener onAcceptButtonClickListener);
// Set cancel click listenner
dialog.setOnCancelButtonClickListener(View.OnClickListener onCancelButtonClickListener);
// Acces to accept button
ButtonFlat acceptButton = dialog.getButtonAccept();
// Acces to cancel button
ButtonFlat cancelButton = dialog.getButtonCancel();

####Color selector

ColorSelector colorSelector = new ColorSelector(Context context,int intialColor, OnColorSelectedListener onColorSelectedListener);
colorSelector.show();

原文地址:https://www.cnblogs.com/Free-Thinker/p/9476774.html

时间: 2024-11-09 00:55:29

material design 的android开源代码整理的相关文章

Material Design设计的开源代码

https://github.com/telly/FloatingAction http://www.csdn.net/article/2014-11-21/2822753-material-design-libs/1 android 属性动画的开源代码: http://www.jcodecraeer.com/a/opensource/2014/1012/1746.html

Android 基于ijkplayer+Rxjava+Rxandroid+Retrofit2.0+MVP+Material Design的android万能播放器aaa

MDPlayer万能播放器 MDPlayer,基于ijkplayer+Rxjava+Rxandroid+Retrofit2.0+MVP+Material Design的android万能播放器,可以播放本地和在线视频,可以浏览宅男杀手妹纸图片,UI设计遵循 Material Design. GitHub地址:https://github.com/Dawish/MDPlayer UI浏览:         1.UI设计: 列表使用RecyclerView,item为CardView并设置rippl

常见的Android开源代码以及框架

Android SDK源代码 http://grepcode.com/project/repository.grepcode.com/java/ext/com.google.android/android/ 开源代码 http://www.open-open.com/lib/view/open1404286864296.htmlhttp://www.apkbus.com/android-170798-1-1.html Gif 图片显示框架https://github.com/koral--/an

android开源代码演示项目CodeBox

CodeBox是一个搜集优秀android开源代码并提供演示的安卓客户端,其演示功能是将开源项目作为插件加载到客户端中.插件的实现得益于 dynamic-load-apk-Apk动态加载框架https://github.com/singwhatiwanna/dynamic-load-apk . 目前已经完成的插件非常少,还需要大量的编译插件的工作. 希望能有更多的朋友参与进来.项目地址: https://github.com/jianghejie/CodeBox 如果你对该项目感兴趣,可以加入到

Android 常用开源代码整理

1.AndroidAnnotations一个强大的android开源注解框架, 基本上可以注入任何类型, 比一般的所谓的注入框架要快, 因为他是通过生成一个子类来实现的绑定.具体查看文档. 2.android-async-http网络通讯框架 3.ButterKnife一个专注findById的注解框架, 比AndroidAnnotations更方便易用, 但功能稍弱 4.PicassoPicasso 是 Android 上一个强大的图片下载和缓存库. 5.GlideGlide 是一个 Andr

Github上面的Android开源代码(一)

总有一些朋友很热心的整理一些好的资料,在收集之后,可以用作阅读.学习和实践.小伙伴们,总有一天,你也能写出 Niubility 的 Android App :-) 为了防止以上链接失效,以及部分内容丢失,所以,部分搬运过来.自己练习和实践,参考如下链接: GitHub上不错的Android开源项目(一):http://www.cnblogs.com/haochuang/p/4676090.html GitHub上不错的Android开源项目(二):http://www.cnblogs.com/h

创建Material Design风格Android应用--自定义阴影和裁剪视图

之前已经写过通过应用主题和使用ListView, CardView,应用Material Design样式,同一时候都都能够通过support library向下兼容.今天要写的阴影和视图裁剪.无法向下兼容.请注意. ?Material Design 为用户界面元素引入了深度这个元素.深度帮助用户理解各个元素之间的重要关联和帮助用户关注他们手上的任务. 视图的高度(elevation).通过Z属性表现,通过他的阴影确定:z值更高的视图投影出更大的阴影.视图仅仅在Z=0的平面上投影处阴影:他们不会

22个值得收藏的Android开源代码-UI篇

  FileBrowserView 一个强大的文件选择控件.界面比较漂亮,使用也很简单.特点:可以自定义UI:支持复制.剪切.删除.移动文件:可以用在Fragment.ativity.DialogFragment中:支持快速切换目录. 项目地址: https://github.com/psaravan/FileBrowserView MultiItemRowListAdapter 多列效果的ListView,采用重新包装adapter的方式,使你的ListView可以显示成多列,跟普通的List

android开源框架整理,UI,网络,数据库都有

这是一个给力的开源项目,一个给力的人整理的~~~让我们欢呼雀跃吧... 1.git教程: http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000 学习的时候看不懂的东东可以对照着中国的代码托管平台看,差不多  推荐oschina和coding 2.开源框架整理: https://github.com/Trinea/android-open-project#%E5%9B%9Bviewpag