android showcase,直接拿来用!Android-LollipopShowcase

直接拿来用!Android-LollipopShowcase

Android Design

【简介】

Android-LollipopShowcase是由来自奥地利的移动、后端及Web开发者Mike Penz所开发的演示应用,集中演示了新Material Design中所有的UI效果,以及Android Lollipop中其他非常酷炫的特性元素,比如Toolbar、RecyclerView、ActionBarDrawerToggle、Floating Action Button(FAB)、Android Compat Theme等。

【其实也不那么直接==】

导入jar包

先把LollipopShowcase中的LollipopShowcase/app/build/intermediates/exploded-aar/com.mikepenz拷贝到MyAPP/app/intermediates/exploded-aar/目录下~

然后仿照LollipopShowcase/app/build.gradle修改MyAPP/app/build.gradle中的dependencies

dependencies{

compile fileTree(include:['*.jar'],dir:'libs')

compile'com.android.support:support-v4:23.0.0'

compile'com.android.support:appcompat-v7:23.0.0'

compile'com.android.support:recyclerview-v7:23.0.0'

compile'com.android.support:cardview-v7:23.0.0'

compile'com.android.support:design:23.0.0'

compile'com.facebook.rebound:rebound:0.3.8'

compile'com.mikepenz:iconics:1.2.0@aar'

compile('com.mikepenz:aboutlibraries:5.0.6@aar'){

transitive=true

}

compile('com.mikepenz:materialdrawer:3.0.9@aar'){

transitive=true

}

}

自定义的按钮

各属性介绍

solid:实心,就是填充的意思

android:color指定填充的颜色

gradient:渐变

android:startColor和android:endColor分别为起始和结束颜色,ndroid:angle是渐变角度,必须为45的整数倍。

另外渐变默认的模式为android:type="linear",即线性渐变,可以指定渐变为径向渐变,android:type="radial",径向渐变需要指定半径android:gradientRadius="50"。

stroke:描边

android:width="2dp"描边的宽度,android:color描边的颜色。

我们还可以把描边弄成虚线的形式,设置方式为:

android:dashWidth="5dp"

android:dashGap="3dp"

其中android:dashWidth表示'-'这样一个横线的宽度,android:dashGap表示之间隔开的距离。

corners:圆角

android:radius为角的弧度,值越大角越圆。

我们还可以把四个角设定成不同的角度,方法为:

android:topRightRadius="20dp"右上角

android:bottomLeftRadius="20dp"右下角

android:topLeftRadius="1dp"左上角

android:bottomRightRadius="0dp"左下角

/>

c6aced8297e80f1294069c6666f094fa.png

遇到theme的问题

You need to use a Theme.AppCompat theme (or descendant) with this activity

报错如下:

java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

解决方法:

创建的activity继承自support-v7的ActionBarActivity的,只能用AppCompat主题。现在推toolbar了所以就干脆把父类ActionBarActivity改成Activity。

细节修改:

不过我这里MainActivity用的是AS自动生成的带有Fragment的ActionBarActivity,Fragment用的是v4的,ActionBarActivity是v7的。修改后的父类是Android.app.Activity,Activity类没有getSupportFragmentManager函数,需改成getFragmentManager函数,相应的要把Fragment改成Android.app.Fragment。这样待AS自动导包后,就没有报错了~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值