摘要: 发送端: public class MainActivity extends Activity { //先在布局文件main.xml中定义一个Button/* * * * */private Button send_broadcast_button; @Override publ... 阅读全文
posted @ 2014-07-20 20:33 n1rAy 阅读(527) 评论(0) 推荐(0) 编辑
摘要: 有时候我们需要把A activity提交数据给B activity处理,然后把结果返回给A这种方式在很多种情况需要用到,比如我应用的程序需要有拍照上传的功能。一种解决方案是 我的应用程序〉调用系统相机〉拍照〉关闭系统相机〉返回拍照后的照片到我的应用程序启动一个ForResult的意图:Intent ... 阅读全文
posted @ 2014-07-20 20:32 n1rAy 阅读(1506) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/vipzjyno1/article/details/25423543前言由于一个同学问到我如何按照一个流程走好之后回到首页,我以前看到过4个解决方案,后来发现有做个记录和总结的必要,就写了这篇博文。(之前看小强也写过一篇,这里通过自身的分析完整的总结一下以下... 阅读全文
posted @ 2014-07-20 20:29 n1rAy 阅读(319) 评论(0) 推荐(0) 编辑
摘要: 需要加一个权限: ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); List runningTasks = manager .getRunningTasks(1);... 阅读全文
posted @ 2014-07-20 20:27 n1rAy 阅读(889) 评论(0) 推荐(0) 编辑
摘要: 有个问题困扰我一晚上,每次进入Activity后,EditText自动获得焦点弹出软键盘,键盘遮挡listView,使得无法显示最后一条消息。我在edittext点击事件中也设定了,listView.setSelection,选中最后一条数据,可是每次需要点击两下才会显示最新消息,最后在window... 阅读全文
posted @ 2014-07-20 20:26 n1rAy 阅读(255) 评论(0) 推荐(0) 编辑
摘要: //1.利用LayoutInflater的inflate动态加载XML mLinearLayout = (LinearLayout)findViewById(R.id.LinearLayout_ID); LayoutInflater layoutInflater = LayoutInflater... 阅读全文
posted @ 2014-07-20 20:24 n1rAy 阅读(797) 评论(2) 推荐(0) 编辑
摘要: progressDrawable = this.getResources().getDrawable(R.drawable.image);progressDrawable.setBounds(mSeekBar.getProgressDrawable().getBounds());mSeekBar.s... 阅读全文
posted @ 2014-07-20 20:23 n1rAy 阅读(3598) 评论(0) 推荐(0) 编辑
摘要: Android自定义类似ProgressDialog效果的Dialog.方法如下:1.首先准备两张自己要定义成哪样子的效果的图片和背景图片(也可以不要背景)。如我要的效果:2.定义loading_dialog.xml布局文件(这里你也可以按自己的布局效果定义,关键是要有个imageView):[ht... 阅读全文
posted @ 2014-07-20 20:22 n1rAy 阅读(801) 评论(0) 推荐(0) 编辑
摘要: 关于动画的实现,Android提供了Animation,在Android SDK介绍了2种Animation模式:1. Tween Animation:通过对场景里的对象不断做图像变换(平移、缩放、旋转)产生动画效果,即是一种渐变动画;2. Frame Animation:顺序播放事先做好的图像,是... 阅读全文
posted @ 2014-07-20 20:19 n1rAy 阅读(275) 评论(0) 推荐(0) 编辑
摘要: solid:实心,就是填充的意思android:color指定填充的颜色gradient:渐变android:startColor和android:endColor分别为起始和结束颜色... 阅读全文
posted @ 2014-07-20 20:18 n1rAy 阅读(224) 评论(0) 推荐(0) 编辑
摘要: textview1.setTextColor(Color.argb(255, 0, 255, 0)); //文字透明度控件设为半透明:控件名.getBackground().setAlpha(int); int 在0-255之间package net.android.alpha;import a... 阅读全文
posted @ 2014-07-20 20:04 n1rAy 阅读(10619) 评论(0) 推荐(0) 编辑
摘要: TextView textView= (TextView)findViewById(R.id.textview); LinearLayout.LayoutParams linearParams =(LinearLayout.LayoutParams) textView.getLayoutPara... 阅读全文
posted @ 2014-07-20 20:03 n1rAy 阅读(2960) 评论(0) 推荐(0) 编辑
摘要: 使用此功能一定要添加权限:修改方法:manifest.xml 添加权限 转帖请注明本文出自xiaanming的博客(http://blog.csdn.net/xiaanming/article/details/17761431),请尊重他人的辛勤劳动成果,谢谢!我之前写了一篇关于美团网,大众点评的购... 阅读全文
posted @ 2014-07-20 20:01 n1rAy 阅读(1057) 评论(0) 推荐(0) 编辑
摘要: public static int getStatusBarHeight(Context context){ Class c = null; Object obj = null; Field field = null; int x = 0, s... 阅读全文
posted @ 2014-07-20 19:51 n1rAy 阅读(437) 评论(0) 推荐(0) 编辑
摘要: getLocationOnScreen,计算该视图在全局坐标系中的x,y值,(注意这个值是要从屏幕顶端算起,也就是索包括了通知栏的高度)//获取在当前屏幕内的绝对坐标getLocationInWindow,计算该视图在它所在的widnow的坐标x,y值,//获取在整个窗口内的绝对坐标 (不是很理解=... 阅读全文
posted @ 2014-07-20 19:48 n1rAy 阅读(485) 评论(0) 推荐(0) 编辑
摘要: …… ……我们要做的就是自定义一个GridView控件并插入到中间的LinearLayout中public class MyGridView extends GridView{public MyGridView(Context context, AttributeSet attrs) ... 阅读全文
posted @ 2014-07-20 19:45 n1rAy 阅读(619) 评论(0) 推荐(0) 编辑