- 博客(36)
- 资源 (8)
- 收藏
- 关注
原创 android重写webview长按时选择文字然后点击搜索按钮的事件,默认是chrome接受点击事件,现在跳转到360搜索页面
覆盖webview长按时选择文字之后点击搜索的事件
2015-04-29 11:21:23
3628
转载 android gradle使用
使用Eclipse的ADT插件生成Gradle相关的文件360新闻代码的目录结构是遵循的Eclipse ADT插件的要求,主工程依赖一个名为ui的Library工程。如下将这个项目转到AndroidStudio 使用Gradle的话,需要以下的步骤:A. 生成Gradle相关文件一路下一步,把两个项目都选中 执行完这一步之后会
2015-04-13 16:06:23
573
原创 android edittext 自动不获取焦点
在edittext之前的view上加上 android:focusable="true" android:focusableInTouchMode="true"
2014-08-26 17:50:35
559
原创 android 重写 viewpager
重写viewpager在viewpager里调用getChildAt(position)的时候发现有问题查资料发现
2014-07-07 17:49:52
1195
原创 android 自定义 actionbar
设置actionbar的view 并设置LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);getActionBar().setCustomView(actionbar_view, lp);getActionBar().setDisplayHomeAsUpEn
2014-06-25 11:41:12
921
原创 Android 一些错误
android fragment里面放viewpager 嵌套fragment 报错:解决:在adapter的构造方法里加上 super(fragment.getChildFragmentManager)把android项目变成lib的时候会在switch语句那里报错解决:switch语句的case必须是常量R.id.xx 在作为项目的时候是常量 作为lib的时候不是 所以要变
2014-06-17 16:24:10
567
原创 android view 执行动画
if (!isAnimation) {rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);rotateAnimation.setRepeatCount(Animation.INFINITE);rotateAnim
2014-06-04 21:36:09
703
原创 android 软键盘隐藏 activity初始化时edittext聚焦
在xml中某一个view上写上android:focusable="true"android:focusableInTouchMode="true"
2014-05-14 17:49:08
1003
原创 AlarmManager
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);PendingIntent pendingIntent = PendingIntent.getService(context, 0, service, PendingIntent.FLAG_UPDA
2014-04-23 17:13:06
640
原创 android 防止parentView interupt touch事件
@Overridepublic boolean onInterceptTouchEvent(MotionEvent ev) {int action = ev.getAction();switch (action) {case MotionEvent.ACTION_DOWN:ViewParent parent = getParent();if (parent != null)
2014-04-09 16:43:56
481
原创 给textview设置文字旁边的图片
final View child = view.getChildAt(i);((TextView) child).setCompoundDrawablesWithIntrinsicBounds(0,0, 0, bottomDrawableId);((TextView) child).setTextColor(getResources().getColorStateList(bott
2014-04-03 18:56:30
731
原创 android view ontouch view 颤抖
今天写demo时遇到一个现象在代码是这样:child.setOnTouchListener(new OnTouchListener() {@Overridepublic boolean onTouch(View v, MotionEvent event) {if (v == child) {System.out.println(true);}System.o
2014-03-27 15:53:14
1250
原创 android scrollTo 方法为什么传负值往正方向走
最近做的demo里面用到scrollto 和scroller 发现传递负值的时候 view才往坐标轴的正方向滚动很不理解,因为scrollto的注释写的是* @param x the x position to scroll to * @param y the y position to scroll to 查了半天view的代码找到一个可能是原因的地方:代码如下(只
2014-03-26 11:32:51
2163
1
原创 imageview 加载图片的时候 给个渐变效果
// Transition drawable with a transparent drawable and the final drawableTransitionDrawable td = new TransitionDrawable(new Drawable[] {new ColorDrawable(android.R.color.transparent),drawable}); /
2014-03-24 12:05:49
1619
原创 封装dialog显示的代码
public class DialogView { private Context context; private Dialog dialog; public DialogView(Context context) { this.context = context; initDialog(); }
2014-03-16 23:04:06
478
原创 android开发导入了jar包 编译没错 运行时报 classnotfound 解决
导入第3方jar包问题,明明导入了jar但还是报java.lang.NoClassDefFoundError解决步骤:1、在Android项目根目录下新建一个lib文件夹;2、把你需要导入的第3方jar包复制到lib文件夹中;3、在lib文件夹上点右键,选Bulid path –> Use as source folder。如果只是单纯的引入jar,在Eclipse中编译是可以
2014-03-07 15:52:45
1172
转载 Android 常用 uri
下面是一些常用的Uri 显示网页: 1. Uri uri = Uri.parse("http://www.google.com"); 2. Intent it = new Intent(Intent.ACTION_VIEW,uri); 3. startActivity(it);显示地图:1. Uri uri = Uri.parse("geo:38.89
2014-02-24 11:45:25
507
原创 spring mvc的乱码 post请求的响应
我用springmvc在web.xml中写了spring的过滤器org.springframework.web.filter.CharacterEncodingFilter但是使用get的时候会出现乱码结果我转成post了因为get请求据说还要修改tomcat的server.xml我嫌麻烦 就直接改成post了使用post注解:@RequestMapping(val
2013-12-11 19:05:27
563
原创 android 消失软件盘
InputMethodManager imm = (InputMethodManager) App.getInstance().getSystemService(mainActivity.INPUT_METHOD_SERVICE);imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);或者 imm.h
2013-12-11 19:01:39
457
原创 关于maven打包时出现jar包版本的多重引用导致最终war包里的版本不是最新的
在主maven项目里的pom里加上com.aiyoweicomlib0.0.14然后在引用低版本的的项目里最下面加上com.aiyoweicomlib然后打包就会把最新版本的jar包打进去了
2013-12-10 17:40:34
2258
转载 Android service onstartcomand 返回值
Android开发的过程中,每次调用startService(Intent)的时候,都会调用该Service对象的onStartCommand(Intent,int,int)方法,然后在onStartCommand方法中做一些处理。然后我们注意到这个函数有一个int的返回值,这篇文章就是简单地讲讲int返回值的作用。从Android官方文档中,我们知道onStartCommand有4种返回值:
2013-11-18 12:19:49
531
原创 spring mvc学习
我用的是maven在web.xml中加入org.springframework.web.context.ContextLoaderListener我导入之后报了class not found 后来删除了tomcat 指定好了代码编译后的路径之后 突然好了然后添加spring需要加载的xmlcontextConfigLocationclasspath:appl
2013-11-12 16:32:17
431
转载 mysql 语句按时间分组
一、年度查询查询 本年度的数据 SELECT *FROM blog_articleWHERE year( FROM_UNIXTIME( BlogCreateTime ) ) = year( curdate( ))二、查询季度数据查询数据附带季度数 SELECT ArticleId, quarter( FROM_UNIXTIME( `BlogCreat
2013-11-01 18:31:43
1088
转载 [Android]长按电源键(Power Key)的处理
Android4.2代码位置: \frameworks\base\policy\src\com\android\internal\policy\impl\PhoneWindowManager.java关键方法: PhoneWindowManager.java -->interceptKeyBeforeQueueing()case KeyEvent.KEYCODE_POWER: //
2013-10-29 19:09:17
1421
转载 备份数据库
命令在DOS的[url=file://\\mysql\\bin]\\mysql\\bin[/url]目录下执行1.导出整个数据库导出文件默认是存在mysql\bin目录下 mysqldump -u 用户名 -p 数据库名 > 导出的文件名 mysqldump -u user_name -p123456 database_name > outfile_name.sql
2013-10-29 11:17:28
551
转载 redis 分析
转自timyang:http://timyang.net/data/redis-misunderstanding/前几天微博发生了一起大的系统故障,很多技术的朋友都比较关心,其中的原因不会超出James Hamilton在On Designing and Deploying Internet-Scale Service(1)概括的那几个范围,James第一条经验“Design for fa
2013-10-28 18:18:39
657
原创 spring 的定时器
一般开发系统,使用定时任务非常常见。当然也可以用Java实现。比如定时器。大致如下: 1: public static void main(String[] args) { 2: Timer timer = new Timer(); 3: timer.schedule(new java.util.TimerTask() {
2013-10-23 18:10:28
465
原创 Spring 3 MVC 接收客户端上传的文件
Spring1 推出的时候可以说是不小的颠覆了J2EE 的开发,彻底把EJB打败,将J2EE开发进行简化,Spring2 推出以后完美的与多种开源框架与服务器的结合,让你对其拥抱的更紧,Spring变成了一个工具箱,一应俱全,Spring3 推出以后让开发真正的得到简单化,并且Spring3支持REST风格,采用Spring3进行开发,简单的有点过分了。如果说我在吹嘘,那么1行有效
2013-10-23 16:48:07
1219
转载 Android下载文件的进度条提示
try {//set the download URL, a url that points to a file on the internet//this is the file to be downloadedURL url = new URL("http://somewhere.com/some/webhosted/file"); //create t
2013-09-27 16:00:08
510
原创 android Options.inPurgeable的意思
BitmapFactory.Options.inPurgeable;如果 inPurgeable 设为True的话表示使用BitmapFactory创建的Bitmap用于存储Pixel的内存空间在系统内存不足时可以被回收,在应用需要再次访问Bitmap的Pixel时(如绘制Bitmap或是调用getPixel),系统会再次调用BitmapFactory decoder重新生成Bitmap的Pi
2013-09-16 17:43:11
6118
原创 listview 一直显示最底部 和 显示刷新之前的位置
listview.setTranscriptMode(AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);设置listview以聊天的方式显示最底部的东东记住listview显示的位置 刷新之后 保留之前的位置Parcelable state = listView.onSaveInstanceState();myAdapter.no
2013-09-16 15:28:09
975
转载 Can not perform this action after onSaveInstanceState
今天使用Fragment的时候,出现了这个错误 IllegalStateException: Can not perform this action after onSaveInstanceState:E/AndroidRuntime(12747): Caused by: java.lang.IllegalStateException: Can not perform this act
2013-09-12 11:40:00
558
原创 android获取相册图片 拍照获取图片 用到的东西
/*** from gallery* * @return*/public static Intent getPhotoPickIntent() {Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);intent.setType("image/*");return intent;}
2013-09-11 10:36:51
545
原创 android 改变spinner的文字大小 颜色的思路
spinner = (Spinner) view.findViewById(R.id.crow_search_select);ArrayAdapter arrayAdapter = ArrayAdapter.createFromResource(App.activity,R.array.search_orders,R.layout.spinner_text_color);//
2013-09-10 11:04:16
978
原创 android xml设置dialog的进出动画
dialog = new Dialog(context, R.style.TransparentDialog_Normal);// 设置自定义的类型 包括进出动画dialog.getWindow().setWindowAnimations(R.style.dialogWindowAnim);// 设置dialog的布局dialog.setContentView(pullView);
2013-09-10 11:04:00
1154
android webview播放网页视频
2014-03-26
android网络访问封装的代码
2013-09-16
android客户端的接收简单代码
2012-12-30
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人