Android 开发小技巧

Android 开发小技巧,第1张

概述1、5.0以上点击水波纹效果在想要实现效果的布局或控件中加入:android:clickable=\"true\" 1、5.0以上点击水波纹效果

在想要实现效果的布局或控件中加入:

androID:clickable="true"androID:background="?androID:attr/selectableItemBackground" 
2、5.0以上使用4.0的时间日期选择控件样式

在DatePicker布局文件中有个

//4.0样式androID:datePickerMode="spinner"//5.0样式androID:datePickerMode="calendar" 
3、图片着色

再也不用生成好多相同的图表了 ImageVIEw

androID:tint="@color/color" 

drawableleft…

androID:drawableleft="@mipmap/ic_search"androID:drawableTint="@color/color" 
4、使用系统小图标

使用系统的菜单搜索图表,可以配合着色使用

androID:drawableRight="@androID:drawable/ic_menu_search" 
5、快速实现Activity切换动画

在anim中创建 fade_in.xml //进入动画–淡入

<Alphaxmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:duration="300"    androID:fromAlpha="0.0"    androID:interpolator="@androID:anim/accelerate_interpolator"    androID:toAlpha="1.0" /> 

fade_out.xml //出场动画–淡出

<Alphaxmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:duration="300"    androID:fromAlpha="1.0"    androID:interpolator="@androID:anim/accelerate_interpolator"    androID:toAlpha="0.0" /> 

最后在style.xml中

<stylename="FadeAnimationStyle" parent="@androID:style/Animation.Activity">    <itemname="androID:activityOpenEnteranimation">@anim/fade_in</item>    <itemname="androID:activityOpenExitAnimation">@anim/fade_out</item>    <itemname="androID:activityCloseEnteranimation">@anim/fade_in</item>    <itemname="androID:activityCloseExitAnimation">@anim/fade_out</item></style> 

最后在你使用的style里面加入下面这行即可

<itemname="androID:windowAnimationStyle">@style/FadeAnimationStyle</item> 

本文地址: http://jwenfeng.com/?p=219

尊重原创,转载请注明:From 晓峰残月(http://jwenfeng.com) 侵权必究!

总结

以上是内存溢出为你收集整理的Android 开发小技巧全部内容,希望文章能够帮你解决Android 开发小技巧所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1148920.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存