随笔分类 -  Android

Android实现圆形图形不断旋转的动画
摘要:简单记录O(∩_∩)O~新建anim目录,并新建实现旋转的动画文件roraterepeat.xml<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" > <rotate android:duration="1000" android:fromDegrees="0" android:interpolator=" 阅读全文
posted @ 2012-07-30 16:53 YoVinci 阅读(3405) 评论(1) 推荐(1) 编辑
Android代码片段二:不规则图形按钮非透明区的点击
摘要:/** * 不规则"图形按钮控件" * */public class TrapezoidImageButton extends ImageButton { public TrapezoidImageButton(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public TrapezoidImageButton(Context context, AttributeSet attrs) { super(context, attrs); ... 阅读全文
posted @ 2012-07-30 16:04 YoVinci 阅读(2294) 评论(0) 推荐(0) 编辑
Android代码片段一:根据Android版本使用Animation跳转Activity
摘要:public void startActivity(Intent intent, int animationEnterId, int animationLeaveId) { Activity activity = this; activity = TinyUtils.getRootActivity(this); if (activity == this) { super.startActivity(intent); } else { activity.startActivity(intent); } try { ... 阅读全文
posted @ 2012-07-30 11:23 YoVinci 阅读(215) 评论(0) 推荐(0) 编辑
Android中Activity间的数据传递
摘要:效果:有两个Activity分别为A和B,从A中采用Bundle封装数据向B中传递数据,然后使用startActivityForResult在B中修改后回传数据。第一个Activity的layout如main.xml: 1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:orientation="vertica 阅读全文
posted @ 2012-07-02 00:06 YoVinci 阅读(385) 评论(0) 推荐(0) 编辑
Android自定义Animation
摘要:先呈上我测试动画的界面:布局文件main.xml为:<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertica 阅读全文
posted @ 2012-06-14 17:32 YoVinci 阅读(924) 评论(1) 推荐(0) 编辑
Android中在EditText输入文字后同步显示在TextView
摘要:我好像总是对控件情有独钟的O(∩_∩)O,近来就打算写写Android基础控件的使用,希望可以从中挖掘一些新的东西。这次的例子是从EditText中输入文字,然后在TextView中同步显示,实现实时输入输出。关键就是用OnKeyListener监听EditText的键盘输入事件。例子比较简单,直接上代码。main.xml布局:<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res 阅读全文
posted @ 2012-06-14 15:24 YoVinci 阅读(4128) 评论(5) 推荐(0) 编辑
为Android自定义控件自定义属性
摘要:Android原有的属性可能不能满足我们现在要做的事,毕竟有些人就是会天马行空的想出一些Android不会做的东西。今天就简单的写下怎样为自定义控件自定义属性,看这种描述有点晕,转过来就是控件和属性都是自定义的吧。哈~上面是运行界面,有两个自定义的Button,主要是用来区分。首先在res/values/目录下新建attrs.xml文件,用来自定义属性<?xml version="1.0" encoding="utf-8"?><resources> <declare-styleable name="MyCustom 阅读全文
posted @ 2012-06-06 14:55 YoVinci 阅读(1876) 评论(3) 推荐(2) 编辑
Android自定义控件之AlertDialog
摘要:最近公司没什么项目做,大部分时间都是自己在学习,而且觉得有必要和各位园友分享、交流下自己的所学所得,所以呢,决定今天开始写博吧。嗯嗯,步入正题,很多时候Android自带的控件样式不能满足我们多样化的需求,要自己去自定义才会给人耳目一新的感觉,今天就先拿AlertDialog开导,哈~先上效果图(比较喜欢柯南O(∩_∩)O):点击enter按钮会关闭对话框,留在当前Activity,点击exit按钮则退出应用。首先是main.xml:<?xml version="1.0" encoding="utf-8"?><LinearLayout 阅读全文
posted @ 2012-06-05 15:24 YoVinci 阅读(2411) 评论(4) 推荐(1) 编辑